Skip to content

Commit 303e74c

Browse files
Make rubocop happy
1 parent 346e052 commit 303e74c

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,6 @@ Style/TrailingCommaInHashLiteral:
113113

114114
RSpec/ExampleLength:
115115
Max: 10
116+
117+
RSpec/MessageSpies:
118+
EnforcedStyle: receive

spec/mongo/server/connection_pool/generation_manager_spec.rb

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,25 @@
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
3930
end

0 commit comments

Comments
 (0)