Sha256: 9a5efdd5c7eec2fbf1ab33bc79e58b5b3736eebd2a3a4e5d058eeb5c4ac40687

Contents?: true

Size: 437 Bytes

Versions: 21

Compression:

Stored size: 437 Bytes

Contents

module DatabaseCleaner
  module Mongo
    module TruncationMixin

      def clean
        if @only
          collections.each { |c| c.remove if @only.include?(c.name) }
        else
          collections.each { |c| c.remove unless @tables_to_exclude.include?(c.name) }
        end
        true
      end

      private

      def collections
        database.collections.select { |c| c.name !~ /^system\./ }
      end

    end
  end
end

Version data entries

21 entries across 16 versions & 4 rubygems

Version Path
database_cleaner-1.5.1 lib/database_cleaner/mongo/truncation_mixin.rb
database_cleaner-1.5.0 lib/database_cleaner/mongo/truncation_mixin.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/database_cleaner-1.4.1/lib/database_cleaner/mongo/truncation_mixin.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/database_cleaner-1.4.1/lib/database_cleaner/mongo/truncation_mixin.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/database_cleaner-1.4.1/lib/database_cleaner/mongo/truncation_mixin.rb
database_cleaner-1.4.1 lib/database_cleaner/mongo/truncation_mixin.rb
database_cleaner-1.4.0 lib/database_cleaner/mongo/truncation_mixin.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/database_cleaner-1.2.0/lib/database_cleaner/mongo/truncation_mixin.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/database_cleaner-1.2.0/lib/database_cleaner/mongo/truncation_mixin.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/database_cleaner-1.2.0/lib/database_cleaner/mongo/truncation_mixin.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/database_cleaner-1.2.0/lib/database_cleaner/mongo/truncation_mixin.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/database_cleaner-1.2.0/lib/database_cleaner/mongo/truncation_mixin.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/database_cleaner-1.2.0/lib/database_cleaner/mongo/truncation_mixin.rb
database_cleaner-1.3.0 lib/database_cleaner/mongo/truncation_mixin.rb
database_cleaner-1.2.0 lib/database_cleaner/mongo/truncation_mixin.rb
database_cleaner-1.1.1 lib/database_cleaner/mongo/truncation_mixin.rb
database_cleaner-1.1.0 lib/database_cleaner/mongo/truncation_mixin.rb
database_cleaner-1.0.1 lib/database_cleaner/mongo/truncation_mixin.rb
database_cleaner-1.0.0.RC1 lib/database_cleaner/mongo/truncation_mixin.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.9.1/lib/database_cleaner/mongo/truncation_mixin.rb