Register an at_exit hook that runs the suite.
# File lib/rspec/core/runner.rb, line 8 8: def self.autorun 9: return if autorun_disabled? || installed_at_exit? || running_in_drb? 10: at_exit { exit run(ARGV, $stderr, $stdout).to_i unless $! } 11: @installed_at_exit = true 12: end
# File lib/rspec/core/runner.rb, line 19 19: def self.autorun_disabled? 20: @autorun_disabled ||= false 21: end
# File lib/rspec/core/runner.rb, line 15 15: def self.disable_autorun! 16: @autorun_disabled = true 17: end
# File lib/rspec/core/runner.rb, line 23 23: def self.installed_at_exit? 24: @installed_at_exit ||= false 25: end
Run a suite of RSpec examples.
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 - an array of command-line-supported arguments
err - error stream (Default: $stderr)
out - output stream (Default: $stdout)
#### Returns
Fixnum - exit status code (0/1)
# File lib/rspec/core/runner.rb, line 56 56: def self.run(args, err=$stderr, out=$stdout) 57: trap_interrupt 58: options = ConfigurationOptions.new(args) 59: options.parse_options 60: 61: if options.options[:drb] 62: begin 63: DRbCommandLine.new(options).run(err, out) 64: rescue DRb::DRbConnError 65: err.puts "No DRb server is running. Running in local process instead ..." 66: CommandLine.new(options).run(err, out) 67: end 68: else 69: CommandLine.new(options).run(err, out) 70: end 71: ensure 72: RSpec.reset 73: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.