Sha256: b9f35782e806ca57eebc15882a3be26011d2547d7c69089755b08d6ecbed5aa1

Contents?: true

Size: 1014 Bytes

Versions: 14

Compression:

Stored size: 1014 Bytes

Contents

$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require './test/replica_sets/rs_test_helper'

# NOTE: This test expects a replica set of three nodes to be running on RS.host,
# on ports TEST_PORT, RS.ports[1], and TEST + 2.
class ConnectionStringTest < Test::Unit::TestCase
  include Mongo

  def setup
    RS.restart_killed_nodes
  end

  def teardown
    RS.restart_killed_nodes
  end

  def test_connect_with_connection_string
    @conn = Connection.from_uri("mongodb://#{RS.host}:#{RS.ports[0]},#{RS.host}:#{RS.ports[1]}?replicaset=#{RS.name}")
    assert @conn.is_a?(ReplSetConnection)
    assert @conn.connected?
  end

  def test_connect_with_full_connection_string
    @conn = Connection.from_uri("mongodb://#{RS.host}:#{RS.ports[0]},#{RS.host}:#{RS.ports[1]}?replicaset=#{RS.name};safe=true;w=2;fsync=true;slaveok=true")
    assert @conn.is_a?(ReplSetConnection)
    assert @conn.connected?
    assert_equal 2, @conn.safe[:w]
    assert @conn.safe[:fsync]
    assert @conn.read_pool
  end

end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
vanity-1.7.1 vendor/ruby/1.9.1/gems/mongo-1.3.1/test/replica_sets/connection_string_test.rb
jonbell-mongo-1.3.1.2 test/replica_sets/connection_string_test.rb
mongo-lyon-1.2.4 test/replica_sets/connection_string_test.rb
mongo-1.3.1 test/replica_sets/connection_string_test.rb
mongo-1.3.0 test/replica_sets/connection_string_test.rb
mongo-1.3.0.rc0 test/replica_sets/connection_string_test.rb
mongo-1.2.4 test/replica_sets/connection_string_test.rb
mongo-1.2.3 test/replica_sets/connection_string_test.rb
mongo-1.2.2 test/replica_sets/connection_string_test.rb
mongo-1.2.1 test/replica_sets/connection_string_test.rb
mongo-1.2.0 test/replica_sets/connection_string_test.rb
mongo-1.2.rc2 test/replica_sets/connection_string_test.rb
mongo-1.2.rc1 test/replica_sets/connection_string_test.rb
mongo-1.2.rc0 test/replica_sets/connection_string_test.rb