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

Commit b6eba16

Browse files
committed
Avoid logged messages showing up as part of our spec suite output.
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.
1 parent 7a8aa1d commit b6eba16

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/rspec/core/runner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def self.handle_interrupt
175175
exit!(1)
176176
else
177177
RSpec.world.wants_to_quit = true
178-
STDERR.puts "\nRSpec is shutting down and will print the summary report... Interrupt again to force quit."
178+
$stderr.puts "\nRSpec is shutting down and will print the summary report... Interrupt again to force quit."
179179
end
180180
end
181181
end

spec/rspec/core/runner_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
142142
expect(Runner).not_to receive(:exit)
143143
expect(Runner).not_to receive(:exit!)
144-
interrupt
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)
151152
expect(Runner).to receive(:exit!).with(1)
152-
interrupt
153+
expect { interrupt }.to output(//).to_stderr
153154
interrupt
154155
end
155156
end

0 commit comments

Comments
 (0)