123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Core::Bisect::ForkRunner::RunDispatcher Private

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: rspec-core/lib/rspec/core/bisect/fork_runner.rb

Class Method Summary

Instance Method Summary

Instance Method Details

#dispatch_specs(run_descriptor)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/bisect/fork_runner.rb', line 93

def dispatch_specs(run_descriptor)
  pid = fork { run_specs(run_descriptor) }
  # We don't use Process.waitpid here as it was causing bisects to
  # block due to the file descriptor limit on OSX / Linux. We need
  # to detach the process to avoid having zombie processes
  # consuming slots in the kernel process table during bisect runs.
  Process.detach(pid)
end

#run_specs(run_descriptor) (private)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/bisect/fork_runner.rb', line 104

def run_specs(run_descriptor)
  $stdout = $stderr = @spec_output
  formatter = CaptureFormatter.new(run_descriptor.failed_example_ids)

  @runner.configuration.tap do |c|
    c.files_or_directories_to_run = run_descriptor.all_example_ids
    c.formatter = formatter
    c.load_spec_files
  end

  # `announce_filters` has the side effect of implementing the logic
  # that honors `config.run_all_when_everything_filtered` so we need
  # to call it here. When we remove `run_all_when_everything_filtered`
  # (slated for RSpec 4), we can remove this call to `announce_filters`.
  @runner.world.announce_filters

  @runner.run_specs(@runner.world.ordered_example_groups)
  latest_run_results = formatter.results

  if latest_run_results.nil? || latest_run_results.all_example_ids.empty?
    @channel.send(@spec_output.string)
  else
    @channel.send(latest_run_results)
  end
end