File tree Expand file tree Collapse file tree 1 file changed +14
-21
lines changed Expand file tree Collapse file tree 1 file changed +14
-21
lines changed Original file line number Diff line number Diff line change 22
33describe Mongo ::Client do
44
5+ after do
6+ begin ; client . close ; rescue ; end
7+ end
8+
59 describe '#==' do
610
711 let ( :client ) do
1216 )
1317 end
1418
15- after do
16- client . close
17- end
18-
1919 context 'when the other is a client' do
2020
21+ after do
22+ other . close
23+ end
24+
2125 context 'when the options and cluster are equal' do
2226
2327 let ( :other ) do
105109
106110 context 'when the other is a client' do
107111
112+ after do
113+ other . close
114+ end
115+
108116 context 'when the options and cluster are equal' do
109117
110118 let ( :other ) do
228236 described_class . new ( [ default_address . seed ] , authorized_client . options . merge ( options ) )
229237 end
230238
231- after do
232- client . close
233- end
234-
235239 it 'sets the option' do
236240 expect ( client . options [ 'retry_writes' ] ) . to eq ( options [ :retry_writes ] )
237241 end
243247 described_class . new ( [ default_address . seed ] , authorized_client . options . merge ( options ) )
244248 end
245249
246- after do
247- client . close
248- end
249-
250250 context 'when the compressor is supported' do
251251
252252 let ( :options ) do
456456 authorized_client . with ( logger : logger )
457457 end
458458
459- after do
460- client . close
461- end
462-
463459 it 'does not use the global logger' do
464460 expect ( client . cluster . logger ) . to_not eq ( Mongo ::Logger . logger )
465461 end
13731369 client . list_databases ( { } , true )
13741370 end
13751371
1376- after do
1377- client . close
1378- end
1379-
13801372 it 'sends the command with the nameOnly flag set to true' do
13811373 expect ( command [ :nameOnly ] ) . to be ( true )
13821374 end
14291421 end
14301422
14311423 before do
1432- expect ( client . cluster ) . to receive ( :disconnect! ) . and_call_original
1424+ # note that disconnect! is called also in the after block
1425+ expect ( client . cluster ) . to receive ( :disconnect! ) . twice . and_call_original
14331426 end
14341427
14351428 it 'disconnects the cluster and returns true' do
You can’t perform that action at this time.
0 commit comments