Sha256: b14799d11b7bebbc870eff6c25ff676246f15eb1064a1f139903f8f5d92d890e

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'database_cleaner/mongoid/base'
require 'database_cleaner/generic/truncation'
require 'database_cleaner/mongo/truncation_mixin'
require 'database_cleaner/mongo2/truncation_mixin'
require 'database_cleaner/moped/truncation_base'
require 'mongoid/version'

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

      if ::Mongoid::VERSION < '3'

        include ::DatabaseCleaner::Mongo::TruncationMixin

        private

        def database
          ::Mongoid.database
        end

      elsif ::Mongoid::VERSION < '5'

        include ::DatabaseCleaner::Moped::TruncationBase

        private

        def session
          ::Mongoid.default_client
        end

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

      else

        include ::DatabaseCleaner::Mongo2::TruncationMixin

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
database_cleaner-1.5.2 lib/database_cleaner/mongoid/truncation.rb