Method: RSpec::Core::Runner.autorun

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

.autorunvoid

Note:

This is not generally needed. The rspec command takes care of running examples for you without involving an at_exit hook. This is only needed if you are running specs using the ruby command, and even then, the normal way to invoke this is by requiring rspec/autorun.

Register an at_exit hook that runs the suite when the process exits.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rspec/core/runner.rb', line 16

def self.autorun
  if autorun_disabled?
    RSpec.deprecate("Requiring `rspec/autorun` when running RSpec via the `rspec` command")
    return
  elsif installed_at_exit? || running_in_drb?
    return
  end

  at_exit { perform_at_exit }
  @installed_at_exit = true
end