Sha256: 070ed80737289e48b88c894b0b317b889c8edb6e57ef1f4ee97720b83a35d6f2

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 KB

Contents

require 'database_cleaner/mongoid/base'
require 'database_cleaner/generic/truncation'
require 'database_cleaner/mongoid/mongo1_truncation_mixin'
require 'database_cleaner/mongoid/mongo2_truncation_mixin'
require 'database_cleaner/mongoid/mongoid_truncation_mixin'
require 'mongoid/version'

module DatabaseCleaner
  module Mongoid
    class Truncation
      include ::DatabaseCleaner::Mongoid::Base
      include ::DatabaseCleaner::Generic::Truncation

      if ::Mongoid::VERSION < '3'

        include ::DatabaseCleaner::Mongoid::Mongo1TruncationMixin

        private

        def database
          ::Mongoid.database
        end

      elsif ::Mongoid::VERSION < '5'

        include ::DatabaseCleaner::Mongoid::MongoidTruncationMixin

        private

        def session
          ::Mongoid::VERSION > "5.0.0" ? ::Mongoid.default_client : ::Mongoid.default_session
        end

        def database
          if not(@db.nil? or @db == :default)
            ::Mongoid.databases[@db]
          else
            ::Mongoid.database
          end
        end

      else

        include ::DatabaseCleaner::Mongoid::Mongo2TruncationMixin

      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
database_cleaner-mongoid-1.99.0 lib/database_cleaner/mongoid/truncation.rb
database_cleaner-1.99.0 adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/truncation.rb
database_cleaner-1.99.0.beta adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/truncation.rb
database_cleaner-mongoid-1.99.0.beta lib/database_cleaner/mongoid/truncation.rb
database_cleaner-1.8.5 adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/truncation.rb
database_cleaner-1.8.4 adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/truncation.rb
database_cleaner-1.8.3 adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/truncation.rb
database_cleaner-1.8.2 adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/truncation.rb
database_cleaner-mongoid-1.8.1 lib/database_cleaner/mongoid/truncation.rb