File tree Expand file tree Collapse file tree 2 files changed +9
-15
lines changed
spec/mongo/server/connection_pool Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -113,3 +113,6 @@ Style/TrailingCommaInHashLiteral:
113113
114114RSpec/ExampleLength :
115115 Max : 10
116+
117+ RSpec/MessageSpies :
118+ EnforcedStyle : receive
Original file line number Diff line number Diff line change 66 describe '#close_all_pipes' do
77 let ( :service_id ) { 'test_service_id' }
88
9- let ( :server ) { instance_double ( ' Mongo::Server' ) }
9+ let ( :server ) { instance_double ( Mongo ::Server ) }
1010
1111 let ( :manager ) { described_class . new ( server : server ) }
1212
1313 before do
1414 manager . pipe_fds ( service_id : service_id )
1515 end
1616
17- it 'closes all pipes' do
17+ it 'closes all pipes and removes them from the map ' do
1818 expect ( manager . pipe_fds ( service_id : service_id ) . size ) . to eq ( 2 )
1919
20- manager . instance_variable_get ( :@pipe_fds ) [ service_id ] . each do |gen , ( r , w ) |
21- expect ( r ) . to receive ( :close )
22- expect ( w ) . to receive ( :close )
20+ manager . instance_variable_get ( :@pipe_fds ) [ service_id ] . each do |_gen , ( r , w ) |
21+ expect ( r ) . to receive ( :close ) . and_call_original
22+ expect ( w ) . to receive ( :close ) . and_call_original
2323 end
2424
2525 manager . close_all_pipes
26- end
27-
28- it 'removes all pipes from the map' do
29- expect ( manager . pipe_fds ( service_id : service_id ) . size ) . to eq ( 2 )
3026
31- manager . instance_variable_get ( :@pipe_fds ) [ service_id ] . each do |gen , ( r , w ) |
32- expect ( r ) . to receive ( :close )
33- expect ( w ) . to receive ( :close )
34- end
35-
36- manager . close_all_pipes
27+ expect ( manager . instance_variable_get ( :@pipe_fds ) ) . to be_empty
3728 end
3829 end
3930end
You can’t perform that action at this time.
0 commit comments