Skip to content

Commit

Permalink
more at_exit hax to play nice w/ rcov
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Aug 22, 2011
1 parent 03a5ca5 commit dc290d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions lib/rspec/core/runner.rb
Expand Up @@ -8,12 +8,9 @@ class Runner
def self.autorun
return if autorun_disabled? || installed_at_exit? || running_in_drb?
@installed_at_exit = true
# The order here is important, the at_exit handler must be installed before anyone else gets a chance
# to install their own, that way we can be assured that our exit will be last to run (at_exit stacks).
# see https://github.com/jnicklas/capybara/issues/178
exit_code = nil
at_exit { exit exit_code if exit_code && exit_code != 0 }
exit_code = run(ARGV, $stderr, $stdout).to_i
at_exit { exit exit_code }
at_exit { exit_code = run(ARGV, $stderr, $stdout).to_i }
end
AT_EXIT_HOOK_BACKTRACE_LINE = "#{__FILE__}:#{__LINE__ - 2}:in `autorun'"

Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core/runner_spec.rb
Expand Up @@ -8,7 +8,7 @@ module RSpec::Core
RSpec::Core::Runner.stub(:running_in_drb?).and_return(false)
RSpec::Core::Runner.stub(:at_exit_hook_disabled?).and_return(false)
RSpec::Core::Runner.stub(:run).and_return(-1)
RSpec::Core::Runner.should_receive(:at_exit)
RSpec::Core::Runner.should_receive(:at_exit).twice
RSpec::Core::Runner.autorun
end

Expand Down

0 comments on commit dc290d3

Please sign in to comment.