Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Fix exit code of parallel_rspec
Browse files Browse the repository at this point in the history
Without `English` being required, `$CHILD_STATUS` in line 26 is
undefined and thus evaluates to `nil`, and `nil.to_i` is `0`. So
parallel_rspec always returned `0` -> success, even when specs
failed.
  • Loading branch information
iGEL committed Nov 11, 2016
1 parent 13e559c commit d10473b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/zeus/parallel_tests/worker.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require_relative '../parallel_tests'
require 'tempfile'
require 'English'

module Zeus
module ParallelTests
Expand All @@ -22,7 +23,7 @@ def initialize(suite, env, argv)
def spawn
system %(zeus parallel_#{@suite}_worker #{parallel_tests_attributes})
args_file.unlink
$CHILD_STATUS.to_i
$CHILD_STATUS.exitstatus
end

private
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/zeus/parallel_tests/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

it 'returns exit code' do
system 'true'
expect(worker).to receive(:system) { allow($CHILD_STATUS).to receive_messages(to_i: 1) }
expect(worker).to receive(:system) { allow($CHILD_STATUS).to receive_messages(exitstatus: 1) }
expect(subject).to eq(1)
end
end
Expand Down

0 comments on commit d10473b

Please sign in to comment.