Support for multiple databases with Mongoid 3.

To use:
DatabaseCleaner[:mongoid, {:connection => 'db_name'}].strategy = :truncation
DatabaseCleaner[:mongoid, {:connection => 'db_name2'}].strategy = :truncation
This commit is contained in:
Luke Francl 2012-09-10 13:52:49 -07:00
parent 1b906d5b91
commit 34078ffedf

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