Sha256: 00ebb885069185b4c23084dae5766f0e168e5c0dc5dbccd11ce1c4ed326c2de6

Contents?: true

Size: 1020 Bytes

Versions: 6

Compression:

Stored size: 1020 Bytes

Contents

require "test_helper"

class MongoShardedClientTest < Test::Unit::TestCase
  include Mongo

  def setup
    ENV["MONGODB_URI"] = nil
  end

  def test_initialize_with_single_mongos_uri
    ENV["MONGODB_URI"] = "mongodb://localhost:27017"
    client = MongoShardedClient.new
    assert_equal [[ "localhost", 27017 ]], client.seeds
  end

  def test_initialize_with_multiple_mongos_uris
    ENV["MONGODB_URI"] = "mongodb://localhost:27017,localhost:27018"
    client = MongoShardedClient.new
    assert_equal [[ "localhost", 27017 ], [ "localhost", 27018 ]], client.seeds
  end

  def test_from_uri_with_string
    client = MongoShardedClient.from_uri("mongodb://localhost:27017,localhost:27018")
    assert_equal [[ "localhost", 27017 ], [ "localhost", 27018 ]], client.seeds
  end

  def test_from_uri_with_env_variable
    ENV["MONGODB_URI"] = "mongodb://localhost:27017,localhost:27018"
    client = MongoShardedClient.from_uri
    assert_equal [[ "localhost", 27017 ], [ "localhost", 27018 ]], client.seeds
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mongo-1.8.5 test/unit/mongo_sharded_client_test.rb
mongo-1.8.4 test/unit/mongo_sharded_client_test.rb
mongo-1.8.4.rc0 test/unit/mongo_sharded_client_test.rb
mongo-1.8.3 test/unit/mongo_sharded_client_test.rb
mongo-1.8.3.rc1 test/unit/mongo_sharded_client_test.rb
mongo-1.8.3.rc0 test/unit/mongo_sharded_client_test.rb