Skip to content

Commit

Permalink
Spec for mongoid#345.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Feb 12, 2015
1 parent 8ee4f95 commit 4ebfbba
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions spec/moped/node_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,33 @@
end
end

pending '#down!' do
describe '#down!' do
describe 'when connected' do
before do
node.connected?
end

before do
node.connected?
node.down!
end
describe 'shutdown' do
before do
node.down!
end

it 'clears out the connection pool' do
expect(node.instance_variable_get(:@pool)).to be_nil
it 'clears out the connection pool' do
expect(node.instance_variable_get(:@pool)).to be_nil
end
end

describe 'shutdown from multiple threads' do
before do
# fake the behavior of @pool that holds its value until shutdown returns
allow(Moped::Connection::Manager).to receive(:shutdown).and_return(node.instance_variable_get(:@pool)).once
node.down!
end

it 'clears out the connection pool before returning' do
expect(node.instance_variable_get(:@pool)).to be_nil
end
end
end
end

Expand Down

0 comments on commit 4ebfbba

Please sign in to comment.