minor: added tests for nonstandard port
This commit is contained in:
parent
5bf512fb80
commit
23bb6c2192
|
@ -22,7 +22,7 @@ class ConnectionTest < Test::Unit::TestCase
|
|||
context "given a single node" do
|
||||
setup do
|
||||
TCPSocket.stubs(:new).returns(new_mock_socket)
|
||||
@conn = Connection.new('localhost', 27107, :connect => false)
|
||||
@conn = Connection.new('localhost', 27017, :connect => false)
|
||||
|
||||
admin_db = new_mock_db
|
||||
admin_db.expects(:command).returns({'ok' => 1, 'ismaster' => 1})
|
||||
|
@ -45,6 +45,22 @@ class ConnectionTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
context "with a nonstandard port" do
|
||||
setup do
|
||||
TCPSocket.stubs(:new).returns(new_mock_socket)
|
||||
@conn = Connection.new('255.255.255.255', 2500, :connect => false)
|
||||
admin_db = new_mock_db
|
||||
admin_db.expects(:command).returns({'ok' => 1, 'ismaster' => 1})
|
||||
@conn.expects(:[]).with('admin').returns(admin_db)
|
||||
@conn.connect_to_master
|
||||
end
|
||||
|
||||
should "set localhost and port correctly" do
|
||||
assert_equal '255.255.255.255', @conn.host
|
||||
assert_equal 2500, @conn.port
|
||||
end
|
||||
end
|
||||
|
||||
context "Connection pooling: " do
|
||||
setup do
|
||||
TCPSocket.stubs(:new).returns(new_mock_socket)
|
||||
|
|
Loading…
Reference in New Issue