Sha256: 4399f99d94810f2999eb3c4f888ea9a1273de3149d533af1434a16d8f3900202
Contents?: true
Size: 831 Bytes
Versions: 1
Compression:
Stored size: 831 Bytes
Contents
module DatabaseCleaner module Mongo2 module TruncationMixin def clean if @only collections.each { |c| database[c].find.delete_many if @only.include?(c) } else collections.each { |c| database[c].find.delete_many unless @tables_to_exclude.include?(c) } end true end private def database if @db.nil? || @db == :default ::Mongoid::Clients.default else ::Mongoid::Clients.with_name(@db) end end def collections if db != :default database.use(db) end database['system.namespaces'].find(:name => { '$not' => /\.system\.|\$/ }).to_a.map do |collection| _, name = collection['name'].split('.', 2) name end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
database_cleaner-1.5.1 | lib/database_cleaner/mongo2/truncation_mixin.rb |