Method: RSpec::Core::Runner.run

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

.run(args, err = $stderr, out = $stdout) ⇒ Fixnum

Run a suite of RSpec examples. Does not exit.

This is used internally by RSpec to run a suite, but is available for use by any other automation tool.

If you want to run this multiple times in the same process, and you want files like spec_helper.rb to be reloaded, be sure to load load instead of require.

Parameters:

  • args (Array)

    command-line-supported arguments

  • err (IO) (defaults to: $stderr)

    error stream

  • out (IO) (defaults to: $stdout)

    output stream

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]

64
65
66
67
68
69
70
71
72
73
# File 'lib/rspec/core/runner.rb', line 64

def self.run(args, err=$stderr, out=$stdout)
  trap_interrupt
  options = ConfigurationOptions.new(args)

  if options.options[:runner]
    options.options[:runner].call(options, err, out)
  else
    new(options).run(err, out)
  end
end