Class: RSpec::Parallel::Runner
- Inherits:
-
Object
- Object
- RSpec::Parallel::Runner
- Defined in:
- lib/rspec/parallel/runner.rb
Instance Attribute Summary collapse
-
#pids ⇒ Array<Integer>
readonly
Array of pids of spawned worker processes.
Instance Method Summary collapse
-
#initialize(args) ⇒ Runner
constructor
A new instance of Runner.
-
#start ⇒ Integer
Exit status code.
Constructor Details
#initialize(args) ⇒ Runner
Returns a new instance of Runner.
13 14 15 16 17 18 19 20 21 |
# File 'lib/rspec/parallel/runner.rb', line 13 def initialize(args) @args = args @pids = [] # Configure RSpec core before initialize master instance and spawning # worker processes to share its configuration. configure_rspec @master = Master.new(args) end |
Instance Attribute Details
#pids ⇒ Array<Integer> (readonly)
Returns array of pids of spawned worker processes.
10 11 12 |
# File 'lib/rspec/parallel/runner.rb', line 10 def pids @pids end |
Instance Method Details
#start ⇒ Integer
Returns exit status code.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rspec/parallel/runner.rb', line 24 def start waiters = [] RSpec::Parallel.configuration.concurrency.times do waiters << spawn_worker end master.run statuses = waiters.map {|waiter| waiter.value } statuses.all? {|status| status.success? } ? 0 : 1 ensure pids.each.with_index do |pid, index| puts "----> output from worker[#{index}]" File.open(output_file_path(pid)) do |file| puts file.read end end end |