File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -137,12 +137,13 @@ class ConnectionSpecTestException < Exception; end
137
137
138
138
it 'logs a warning' do
139
139
messages = [ ]
140
- # Straightforward expectations are not working here for some reason
141
140
expect ( Mongo ::Logger . logger ) . to receive ( :warn ) do |msg |
142
141
messages << msg
143
142
end
143
+
144
144
expect ( error ) . not_to be nil
145
- expect ( messages ) . to include ( expected_message )
145
+
146
+ messages . any? { |msg | msg . include? ( expected_message ) } . should be true
146
147
end
147
148
148
149
end
Original file line number Diff line number Diff line change 189
189
190
190
it 'logs a warning' do
191
191
expect_any_instance_of ( Mongo ::Socket ) . to receive ( :write ) . and_raise ( Mongo ::Error ::SocketError , 'test error' )
192
- expect ( Mongo ::Logger . logger ) . to receive ( :warn ) . with ( expected_message ) . and_call_original
192
+
193
+ messages = [ ]
194
+ expect ( Mongo ::Logger . logger ) . to receive ( :warn ) do |msg |
195
+ messages << msg
196
+ end
197
+
193
198
expect do
194
199
monitor . connection . connect!
195
200
end . to raise_error ( Mongo ::Error ::SocketError , 'test error' )
201
+
202
+ messages . any? { |msg | msg . include? ( expected_message ) } . should be true
196
203
end
197
204
end
198
205
end
You can’t perform that action at this time.
0 commit comments