diff --git a/lib/mongo/repl_set_connection.rb b/lib/mongo/repl_set_connection.rb index 8ce120a..5eea01d 100644 --- a/lib/mongo/repl_set_connection.rb +++ b/lib/mongo/repl_set_connection.rb @@ -89,6 +89,7 @@ module Mongo # Are we allowing reads from secondaries? @read_secondary = opts.fetch(:read_secondary, false) + @slave_okay = false setup(opts) end diff --git a/test/db_test.rb b/test/db_test.rb index 0a53759..3001001 100644 --- a/test/db_test.rb +++ b/test/db_test.rb @@ -123,6 +123,13 @@ class DBTest < Test::Unit::TestCase @@db.remove_user('spongebob') end + def test_authenticate_with_special_characters + assert @@db.add_user('foo:bar', '@foo') + assert @@db.authenticate('foo:bar', '@foo') + @@db.logout + @@db.remove_user('foo:bar') + end + def test_authenticate_with_connection_uri @@db.add_user('spongebob', 'squarepants') assert Mongo::Connection.from_uri("mongodb://spongebob:squarepants@#{host_port}/#{@@db.name}")