This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ def self.handle_interrupt
184
184
exit! ( 1 )
185
185
else
186
186
RSpec . world . wants_to_quit = true
187
- STDERR . puts "\n RSpec is shutting down and will print the summary report... Interrupt again to force quit."
187
+ $stderr . puts "\n RSpec is shutting down and will print the summary report... Interrupt again to force quit."
188
188
end
189
189
end
190
190
end
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ module RSpec::Core
115
115
let ( :interrupt_handlers ) { [ ] }
116
116
117
117
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 |
119
119
interrupt_handlers << block
120
120
end
121
121
end
@@ -137,19 +137,20 @@ def interrupt
137
137
interrupt
138
138
end
139
139
140
- it "does not exit immediately" do
140
+ it "does not exit immediately, but notifies the user " do
141
141
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
145
146
end
146
147
end
147
148
148
149
context "with SIGINT twice" do
149
150
it "exits immediately" do
150
151
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
153
154
interrupt
154
155
end
155
156
end
You can’t perform that action at this time.
0 commit comments