Module: MongoMapper::Plugins::DbConfig::ClassMethods
- Defined in:
- lib/mongo_mapper_ext/mongo_mapper/spec.rb,
lib/mongo_mapper_ext/mongo_mapper/plugins/db_config.rb
Overview
disabling :use_database, all tests will use the same :test database.
Instance Method Summary collapse
-
#_use_database ⇒ Object
Connect to database_alias specified in config.
-
#use_database(database_alias) ⇒ Object
Connect to database_alias specified in config.
Instance Method Details
#_use_database ⇒ Object
Connect to database_alias specified in config
5 6 7 8 9 10 11 |
# File 'lib/mongo_mapper_ext/mongo_mapper/spec.rb', line 5 def use_database database_alias database_alias = database_alias.to_s raise "unknown database alias :#{database_alias}" unless MongoMapper.db_config.include? database_alias self.connection MongoMapper.connections[database_alias] set_database_name MongoMapper.db_config[database_alias]['name'] end |
#use_database(database_alias) ⇒ Object
Connect to database_alias specified in config
79 80 81 82 83 84 85 |
# File 'lib/mongo_mapper_ext/mongo_mapper/plugins/db_config.rb', line 79 def use_database database_alias database_alias = database_alias.to_s raise "unknown database alias :#{database_alias}" unless MongoMapper.db_config.include? database_alias self.connection MongoMapper.connections[database_alias] set_database_name MongoMapper.db_config[database_alias]['name'] end |