class RSpec::Parallel::Worker::SpecRunner

Public Class Methods

new(args) click to toggle source

@param args [Array<String>]

Calls superclass method
# File lib/rspec/parallel/worker.rb, line 97
def initialize(args)
  options = RSpec::Core::ConfigurationOptions.new(args)
  super(options)
end

Public Instance Methods

run_specs(example_groups) click to toggle source

@param example_groups [Array<RSpec::Core::ExampleGroup>] @return [Integer] exit status code

# File lib/rspec/parallel/worker.rb, line 104
def run_specs(example_groups)
  # Reset filter manager to run all specs. Just for simplicity
  # TODO: Support config.run_all_when_everything_filtered = true
  @configuration.filter_manager = RSpec::Core::FilterManager.new

  success = @configuration.reporter.report(0) do |reporter|
    # In genaral, ExampleGroup is configured by evaluating `describe`
    # before `with_suite_hooks`
    RSpec::Core::ExampleGroup.ensure_example_groups_are_configured

    @configuration.with_suite_hooks do
      example_groups.map do |g|
        RSpec::Parallel.configuration.logger.debug("Run #{g.inspect}")
        g.run(reporter)
      end.all?
    end
  end && !@world.non_example_failure

  success ? 0 : @configuration.failure_exit_code
end