module DatabaseCleaner::Mongo::TruncationMixin
Public Instance Methods
clean()
click to toggle source
# File lib/database_cleaner/mongo/truncation_mixin.rb, line 5 def clean if @only collections.each { |c| c.send(truncate_method_name) if @only.include?(c.name) } else collections.each { |c| c.send(truncate_method_name) unless @tables_to_exclude.include?(c.name) } end true end
Private Instance Methods
collections()
click to toggle source
# File lib/database_cleaner/mongo/truncation_mixin.rb, line 16 def collections database.collections.select { |c| c.name !~ /^system\./ } end
truncate_method_name()
click to toggle source
# File lib/database_cleaner/mongo/truncation_mixin.rb, line 20 def truncate_method_name # This constant only exists in the 2.x series. defined?(::Mongo::VERSION) ? :delete_many : :remove end