Class: RSpec::Parallel::Worker::SpecRunner

Inherits:
Core::Runner
  • Object
show all
Defined in:
lib/rspec/parallel/worker.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ SpecRunner

Returns a new instance of SpecRunner.

Parameters:

  • args (Array<String>)


92
93
94
95
# File 'lib/rspec/parallel/worker.rb', line 92

def initialize(args)
  options = RSpec::Core::ConfigurationOptions.new(args)
  super(options)
end

Instance Method Details

#run_specs(example_groups) ⇒ Integer

Returns exit status code.

Parameters:

  • example_groups (Array<RSpec::Core::ExampleGroup>)

Returns:

  • (Integer)

    exit status code



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/rspec/parallel/worker.rb', line 99

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|
    @configuration.with_suite_hooks do
      example_groups.map do |g|
        RSpec::Parallel.configuration.logger.info("Run #{g.inspect}")
        g.run(reporter)
      end.all?
    end
  end && !@world.non_example_failure

  success ? 0 : @configuration.failure_exit_code
end