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

Commit 00a8288

Browse files
committed
Merge pull request #2166 from rspec/remove-logged-messages
Remove logged messages
2 parents 6350b3a + b6eba16 commit 00a8288

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lib/rspec/core/runner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def self.handle_interrupt
184184
exit!(1)
185185
else
186186
RSpec.world.wants_to_quit = true
187-
STDERR.puts "\nRSpec is shutting down and will print the summary report... Interrupt again to force quit."
187+
$stderr.puts "\nRSpec is shutting down and will print the summary report... Interrupt again to force quit."
188188
end
189189
end
190190
end

spec/rspec/core/runner_spec.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ module RSpec::Core
115115
let(:interrupt_handlers) { [] }
116116

117117
before do
118-
allow(Object).to receive(:trap).with("INT", any_args) do |&block|
118+
allow(Runner).to receive(:trap).with("INT", any_args) do |&block|
119119
interrupt_handlers << block
120120
end
121121
end
@@ -137,19 +137,20 @@ def interrupt
137137
interrupt
138138
end
139139

140-
it "does not exit immediately" do
140+
it "does not exit immediately, but notifies the user" do
141141
Runner.send(:trap_interrupt)
142-
expect_any_instance_of(Object).not_to receive(:exit)
143-
expect_any_instance_of(Object).not_to receive(:exit!)
144-
interrupt
142+
expect(Runner).not_to receive(:exit)
143+
expect(Runner).not_to receive(:exit!)
144+
145+
expect { interrupt }.to output(/RSpec is shutting down/).to_stderr
145146
end
146147
end
147148

148149
context "with SIGINT twice" do
149150
it "exits immediately" do
150151
Runner.send(:trap_interrupt)
151-
expect_any_instance_of(Object).to receive(:exit!).with(1)
152-
interrupt
152+
expect(Runner).to receive(:exit!).with(1)
153+
expect { interrupt }.to output(//).to_stderr
153154
interrupt
154155
end
155156
end

0 commit comments

Comments
 (0)