minor: test fix
This commit is contained in:
parent
a034eb2655
commit
6f57665631
|
@ -82,6 +82,7 @@ class Test::Unit::TestCase
|
||||||
socket = Object.new
|
socket = Object.new
|
||||||
socket.stubs(:setsockopt).with(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
|
socket.stubs(:setsockopt).with(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
|
||||||
socket.stubs(:close)
|
socket.stubs(:close)
|
||||||
|
socket.stubs(:closed?)
|
||||||
socket
|
socket
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -73,12 +73,12 @@ class ReadTest < Test::Unit::TestCase
|
||||||
should "use default value on query" do
|
should "use default value on query" do
|
||||||
@cursor = @col.find({:a => 1})
|
@cursor = @col.find({:a => 1})
|
||||||
sock = mock()
|
sock = mock()
|
||||||
sock.expects(:close)
|
sock.expects(:close).twice
|
||||||
read_pool = stub(:sockets_low? => false)
|
read_pool = stub(:sockets_low? => false)
|
||||||
@con.stubs(:read_pool).returns(read_pool)
|
@con.stubs(:read_pool).returns(read_pool)
|
||||||
primary_pool = stub(:sockets_low? => false)
|
primary_pool = stub(:sockets_low? => false)
|
||||||
@con.stubs(:primary_pool).returns(primary_pool)
|
@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|
|
@con.expects(:receive_message).with do |o, m, l, s, c, r|
|
||||||
r == nil
|
r == nil
|
||||||
end.returns([[], 0, 0])
|
end.returns([[], 0, 0])
|
||||||
|
@ -89,10 +89,10 @@ class ReadTest < Test::Unit::TestCase
|
||||||
should "allow override default value on query" do
|
should "allow override default value on query" do
|
||||||
@cursor = @col.find({:a => 1}, :read => :primary)
|
@cursor = @col.find({:a => 1}, :read => :primary)
|
||||||
sock = mock()
|
sock = mock()
|
||||||
sock.expects(:close)
|
sock.expects(:close).twice
|
||||||
primary_pool = stub(:sockets_low? => false)
|
primary_pool = stub(:sockets_low? => false)
|
||||||
@con.stubs(:primary_pool).returns(primary_pool)
|
@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|
|
@con.expects(:receive_message).with do |o, m, l, s, c, r|
|
||||||
r == nil
|
r == nil
|
||||||
end.returns([[], 0, 0])
|
end.returns([[], 0, 0])
|
||||||
|
|
Loading…
Reference in New Issue