Merge pull request #149 from swiftype/master

Multiple database support for Mongoid 3
This commit is contained in:
Ben Mabey 2012-09-10 14:35:45 -07:00
commit e1c3b908d5
2 changed files with 5 additions and 1 deletions

View file

@ -202,7 +202,7 @@ Configuration options
| Active Record | DatabaseCleaner[:active_record] | Connection specified as :symbol keys, loaded from config/database.yml. You may also pass in the ActiveRecord model under the @:model@ key. |
| Data Mapper | DatabaseCleaner[:data_mapper] | Connection specified as :symbol keys, loaded via Datamapper repositories |
| Mongo Mapper | DatabaseCleaner[:mongo_mapper] | Multiple connections not yet supported |
| Mongoid | DatabaseCleaner[:mongoid] | Multiple connections not yet supported |
| Mongoid | DatabaseCleaner[:mongoid] | Multiple databases supported for Mongoid 3. Specify DatabaseCleaner[:mongoid, {:connection => :db_name}] |
| Couch Potato | DatabaseCleaner[:couch_potato] | Multiple connections not yet supported |
| Sequel | DatabaseCleaner[:sequel] | ? |

View file

@ -14,6 +14,10 @@ module DatabaseCleaner
private
def collections
if db != :default
session.use(db)
end
session['system.namespaces'].find(:name => { '$not' => /system|\$/ }).to_a.map do |collection|
_, name = collection['name'].split('.', 2)
name