mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
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:
parent
1b906d5b91
commit
34078ffedf
1 changed files with 4 additions and 0 deletions
|
@ -14,6 +14,10 @@ module DatabaseCleaner
|
||||||
private
|
private
|
||||||
|
|
||||||
def collections
|
def collections
|
||||||
|
if db != :default
|
||||||
|
session.use(db)
|
||||||
|
end
|
||||||
|
|
||||||
session['system.namespaces'].find(:name => { '$not' => /system|\$/ }).to_a.map do |collection|
|
session['system.namespaces'].find(:name => { '$not' => /system|\$/ }).to_a.map do |collection|
|
||||||
_, name = collection['name'].split('.', 2)
|
_, name = collection['name'].split('.', 2)
|
||||||
name
|
name
|
||||||
|
|
Loading…
Add table
Reference in a new issue