Class: DatabaseCleaner::Mongo::Deletion
- Inherits:
-
Strategy
- Object
- Strategy
- DatabaseCleaner::Mongo::Deletion
- Defined in:
- lib/database_cleaner/mongo/deletion.rb
Instance Method Summary collapse
- #clean ⇒ Object
- #db ⇒ Object
-
#initialize(only: [], except: [], cache_tables: nil) ⇒ Deletion
constructor
A new instance of Deletion.
Constructor Details
#initialize(only: [], except: [], cache_tables: nil) ⇒ Deletion
Returns a new instance of Deletion.
8 9 10 11 12 13 14 |
# File 'lib/database_cleaner/mongo/deletion.rb', line 8 def initialize only: [], except: [], cache_tables: nil @only = only @except = except if !cache_tables.nil? DatabaseCleaner.deprecate "The mongo adapter's :cache_tables option has no effect, and will be removed in database_cleaner-mongo 3.0." end end |
Instance Method Details
#clean ⇒ Object
20 21 22 |
# File 'lib/database_cleaner/mongo/deletion.rb', line 20 def clean collections_to_delete.each(&:delete_many) end |
#db ⇒ Object
16 17 18 |
# File 'lib/database_cleaner/mongo/deletion.rb', line 16 def db @db || raise("You have not specified a database. (see Mongo::Database)") end |