From 6f57665631b93fdfe54094e9f1fdddf30ac4efdb Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Mon, 7 Nov 2011 18:01:27 -0500 Subject: [PATCH] minor: test fix --- test/test_helper.rb | 1 + test/unit/read_test.rb | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 5e63b88..17df08f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -82,6 +82,7 @@ class Test::Unit::TestCase socket = Object.new socket.stubs(:setsockopt).with(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) socket.stubs(:close) + socket.stubs(:closed?) socket end diff --git a/test/unit/read_test.rb b/test/unit/read_test.rb index 7f58700..dba4d93 100644 --- a/test/unit/read_test.rb +++ b/test/unit/read_test.rb @@ -73,12 +73,12 @@ class ReadTest < Test::Unit::TestCase should "use default value on query" do @cursor = @col.find({:a => 1}) sock = mock() - sock.expects(:close) + sock.expects(:close).twice read_pool = stub(:sockets_low? => false) @con.stubs(:read_pool).returns(read_pool) primary_pool = stub(:sockets_low? => false) @con.stubs(:primary_pool).returns(primary_pool) - @con.expects(:checkout_reader).returns(sock) + @con.expects(:checkout_reader).twice.returns(sock) @con.expects(:receive_message).with do |o, m, l, s, c, r| r == nil end.returns([[], 0, 0]) @@ -89,10 +89,10 @@ class ReadTest < Test::Unit::TestCase should "allow override default value on query" do @cursor = @col.find({:a => 1}, :read => :primary) sock = mock() - sock.expects(:close) + sock.expects(:close).twice primary_pool = stub(:sockets_low? => false) @con.stubs(:primary_pool).returns(primary_pool) - @con.expects(:checkout_writer).returns(sock) + @con.expects(:checkout_writer).twice.returns(sock) @con.expects(:receive_message).with do |o, m, l, s, c, r| r == nil end.returns([[], 0, 0])