Method: RSpec::Core::Runner#run_specs

Defined in:
lib/rspec/core/runner.rb

#run_specs(example_groups) ⇒ Fixnum

Runs the provided example groups.

Parameters:

Returns:

  • (Fixnum)

    exit status code. 0 if all specs passed, or the configured failure exit code (1 by default) if specs failed.

[View source] [View on GitHub]

113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/rspec/core/runner.rb', line 113

def run_specs(example_groups)
  examples_count = @world.example_count(example_groups)
  examples_passed = @configuration.reporter.report(examples_count) do |reporter|
    @configuration.with_suite_hooks do
      if examples_count == 0 && @configuration.fail_if_no_examples
        return @configuration.failure_exit_code
      end

      example_groups.map { |g| g.run(reporter) }.all?
    end
  end

  exit_code(examples_passed)
end