RUBY-191 fix to pass options to new db with Connection#db
This commit is contained in:
parent
afe8fe3167
commit
a905c3f1f2
|
@ -293,7 +293,7 @@ module Mongo
|
|||
#
|
||||
# @core databases db-instance_method
|
||||
def db(db_name, options={})
|
||||
DB.new(db_name, self)
|
||||
DB.new(db_name, self, options)
|
||||
end
|
||||
|
||||
# Shortcut for returning a database. Use DB#db to accept options.
|
||||
|
|
|
@ -43,6 +43,13 @@ class TestConnection < Test::Unit::TestCase
|
|||
assert_raise Mongo::InvalidNSName do @mongo.db('te st') end
|
||||
end
|
||||
|
||||
def test_options_passed_to_db
|
||||
@pk_mock = Object.new
|
||||
db = @mongo.db('test', :pk => @pk_mock, :strict => true)
|
||||
assert_equal @pk_mock, db.pk_factory
|
||||
assert db.strict?
|
||||
end
|
||||
|
||||
def test_database_info
|
||||
@mongo.drop_database(MONGO_TEST_DB)
|
||||
@mongo.db(MONGO_TEST_DB).collection('info-test').insert('a' => 1)
|
||||
|
|
Loading…
Reference in New Issue