Class: RSpec::Parallel::CommandLine
- Inherits:
-
Core::CommandLine
- Object
- Core::CommandLine
- RSpec::Parallel::CommandLine
- Defined in:
- lib/rspec/parallel/command_line.rb
Instance Method Summary collapse
-
#initialize(options, configuration = RSpec::configuration, world = RSpec::world) ⇒ CommandLine
constructor
A new instance of CommandLine.
-
#run_parallel(err, out) ⇒ Object
Configures and runs a suite.
Constructor Details
#initialize(options, configuration = RSpec::configuration, world = RSpec::world) ⇒ CommandLine
Returns a new instance of CommandLine.
4 5 6 7 8 9 10 11 12 |
# File 'lib/rspec/parallel/command_line.rb', line 4 def initialize(, configuration=RSpec::configuration, world=RSpec::world) if Array === = ConfigurationOptions.new() . end = @configuration = configuration @world = world end |
Instance Method Details
#run_parallel(err, out) ⇒ Object
Configures and runs a suite
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rspec/parallel/command_line.rb', line 18 def run_parallel(err, out) @configuration.error_stream = err @configuration.output_stream ||= out .configure(@configuration) @configuration.load_spec_files @world.announce_filters @configuration.reporter.report(@world.example_count, @configuration.randomize? ? @configuration.seed : nil) do |reporter| begin @configuration.run_hook(:before, :suite) group_threads = RSpec::Parallel::ExampleGroupThreadRunner.new(@configuration.thread_maximum) @world.example_groups.ordered.map {|g| group_threads.run(g, reporter)} group_threads.wait_for_completion @world.example_groups.all? do |g| result_for_this_group = g.filtered_examples.all? { |example| example.[:execution_result].exception.nil? } results_for_descendants = g.children.all? { |child| child.filtered_examples.all? { |example| example.[:execution_result].exception.nil? } } result_for_this_group && results_for_descendants end ? 0 : @configuration.failure_exit_code ensure @configuration.run_hook(:after, :suite) end end end |