test/unit/pool_manager_test.rb in mongo-1.7.1 vs test/unit/pool_manager_test.rb in mongo-1.8.0

- old
+ new

@@ -1,27 +1,27 @@ -require File.expand_path("../../test_helper", __FILE__) +require 'test_helper' include Mongo class PoolManagerTest < Test::Unit::TestCase context "Initialization: " do should "populate pools correctly" do TCPSocket.stubs(:new).returns(new_mock_socket) @db = new_mock_db - @connection = stub("Connection") - @connection.stubs(:connect_timeout).returns(5) - @connection.stubs(:op_timeout).returns(5) - @connection.stubs(:pool_size).returns(2) - @connection.stubs(:pool_timeout).returns(100) - @connection.stubs(:seeds).returns(['localhost:30000']) - @connection.stubs(:socket_class).returns(TCPSocket) - @connection.stubs(:[]).returns(@db) + @client = stub("MongoClient") + @client.stubs(:connect_timeout).returns(5) + @client.stubs(:op_timeout).returns(5) + @client.stubs(:pool_size).returns(2) + @client.stubs(:pool_timeout).returns(100) + @client.stubs(:seeds).returns(['localhost:30000']) + @client.stubs(:socket_class).returns(TCPSocket) + @client.stubs(:[]).returns(@db) - @connection.stubs(:replica_set_name).returns(nil) - @connection.stubs(:log) + @client.stubs(:replica_set_name).returns(nil) + @client.stubs(:log) @arbiters = ['localhost:27020'] @hosts = ['localhost:27017', 'localhost:27018', 'localhost:27019', 'localhost:27020'] @db.stubs(:command).returns( @@ -33,10 +33,10 @@ {'secondary' => true, 'hosts' => @hosts, 'arbiters' => @arbiters}, {'secondary' => true, 'hosts' => @hosts, 'arbiters' => @arbiters}, {'arbiterOnly' => true, 'hosts' => @hosts, 'arbiters' => @arbiters}) seeds = [['localhost', 27017]] - manager = Mongo::PoolManager.new(@connection, seeds) + manager = Mongo::PoolManager.new(@client, seeds) manager.connect assert_equal ['localhost', 27017], manager.primary assert_equal 27017, manager.primary_pool.port assert_equal 2, manager.secondaries.length