spec/mongo/server/monitor_spec.rb in mongo-2.1.0.beta vs spec/mongo/server/monitor_spec.rb in mongo-2.1.0.rc0

- old
+ new

@@ -169,6 +169,27 @@ it 'creates a new thread' do expect(monitor.restart!).not_to be(thread) end end end + + describe '#stop' do + + let(:monitor) do + described_class.new(address, listeners, TEST_OPTIONS) + end + + let!(:thread) do + monitor.run! + end + + before do + expect(monitor.connection).to receive(:disconnect!).and_call_original + monitor.stop! + sleep(1) + end + + it 'kills the monitor thread' do + expect(thread.stop?).to be(true) + end + end end