Parent

Class Index [+]

Quicksearch

RSpec::Core::Runner

Constants

AT_EXIT_HOOK_BACKTRACE_LINE

Public Class Methods

autorun() click to toggle source

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
autorun_disabled?() click to toggle source
    # File lib/rspec/core/runner.rb, line 19
19:       def self.autorun_disabled?
20:         @autorun_disabled ||= false
21:       end
disable_autorun!() click to toggle source
    # File lib/rspec/core/runner.rb, line 15
15:       def self.disable_autorun!
16:         @autorun_disabled = true
17:       end
installed_at_exit?() click to toggle source
    # File lib/rspec/core/runner.rb, line 23
23:       def self.installed_at_exit?
24:         @installed_at_exit ||= false
25:       end
run(args, err=$stderr, out=$stdout) click to toggle source

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
running_in_drb?() click to toggle source
    # File lib/rspec/core/runner.rb, line 27
27:       def self.running_in_drb?
28:         (DRb.current_server rescue false) &&
29:          DRb.current_server.uri =~ /druby\:\/\/127.0.0.1\:/
30:       end
trap_interrupt() click to toggle source
    # File lib/rspec/core/runner.rb, line 32
32:       def self.trap_interrupt
33:         trap('INT') do
34:           exit!(1) if RSpec.wants_to_quit
35:           RSpec.wants_to_quit = true
36:           STDERR.puts "\nExiting... Interrupt again to exit immediately."
37:         end
38:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.