minor: test fix

This commit is contained in:
Kyle Banker 2011-11-07 18:01:27 -05:00
parent a034eb2655
commit 6f57665631
2 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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])