Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Remove logged messages #2166

Merged
merged 2 commits into from
Feb 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rspec/core/runner.rb
Original file line number Diff line number Diff line change
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
15 changes: 8 additions & 7 deletions spec/rspec/core/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ module RSpec::Core
let(:interrupt_handlers) { [] }

before do
allow(Object).to receive(:trap).with("INT", any_args) do |&block|
allow(Runner).to receive(:trap).with("INT", any_args) do |&block|
interrupt_handlers << block
end
end
Expand All @@ -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_any_instance_of(Object).not_to receive(:exit)
expect_any_instance_of(Object).not_to receive(:exit!)
interrupt
expect(Runner).not_to receive(:exit)
expect(Runner).not_to receive(:exit!)

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_any_instance_of(Object).to receive(:exit!).with(1)
interrupt
expect(Runner).to receive(:exit!).with(1)
expect { interrupt }.to output(//).to_stderr
interrupt
end
end
Expand Down