Skip to content

Commit

Permalink
Avoid logged messages showing up as part of our spec suite output.
Browse files Browse the repository at this point in the history
Before this change, `rspec --seed 31448` would result in some extra
messages showing up as part of the output of our spec suite:

> RSpec is shutting down and will print the summary report... Interrupt again to force quit.

This fixes the issue, expecting the output instead.
  • Loading branch information
myronmarston committed Feb 7, 2016
1 parent 7a8aa1d commit b6eba16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/rspec/core/runner.rb
Expand Up @@ -175,7 +175,7 @@ def self.handle_interrupt
exit!(1)
else
RSpec.world.wants_to_quit = true
STDERR.puts "\nRSpec is shutting down and will print the summary report... Interrupt again to force quit."
$stderr.puts "\nRSpec is shutting down and will print the summary report... Interrupt again to force quit."
end
end
end
Expand Down
7 changes: 4 additions & 3 deletions spec/rspec/core/runner_spec.rb
Expand Up @@ -137,19 +137,20 @@ def interrupt
interrupt
end

it "does not exit immediately" do
it "does not exit immediately, but notifies the user" do
Runner.send(:trap_interrupt)
expect(Runner).not_to receive(:exit)
expect(Runner).not_to receive(:exit!)
interrupt

expect { interrupt }.to output(/RSpec is shutting down/).to_stderr
end
end

context "with SIGINT twice" do
it "exits immediately" do
Runner.send(:trap_interrupt)
expect(Runner).to receive(:exit!).with(1)
interrupt
expect { interrupt }.to output(//).to_stderr
interrupt
end
end
Expand Down

0 comments on commit b6eba16

Please sign in to comment.