Sha256: 559f313accd2e21550b45943e34784d073eca66e90d965bc7f53b764d6be53d2

Contents?: true

Size: 1006 Bytes

Versions: 2

Compression:

Stored size: 1006 Bytes

Contents

ENV['MONGOID_ENV'] = 'test'

if Mongoid::Compatibility::Version.mongoid2?
  Mongoid.load! 'spec/config/mongoid2.yml'
elsif Mongoid::Compatibility::Version.mongoid3?
  Mongoid.load! 'spec/config/mongoid3.yml'
elsif Mongoid::Compatibility::Version.mongoid4?
  Mongoid.load! 'spec/config/mongoid4.yml'
elsif Mongoid::Compatibility::Version.mongoid5?
  Mongoid.load! 'spec/config/mongoid5.yml'
else
  fail "unsupported Mongoid version #{Mongoid::VERSION}"
end

RSpec.configure do |config|
  config.before do
    Mongoid.logger.level = Logger::INFO
    Mongo::Logger.logger.level = Logger::INFO if Mongoid::Compatibility::Version.mongoid5?
    Mongoid.purge!
  end
  config.after(:all) do
    if Mongoid::Compatibility::Version.mongoid2?
      Mongoid.master.connection.drop_database(Mongoid.database.name)
    elsif Mongoid::Compatibility::Version.mongoid3? || Mongoid::Compatibility::Version.mongoid4?
      Mongoid.default_session.drop
    else
      Mongoid::Clients.default.database.drop
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/mongoid-compatibility-0.3.1/spec/support/mongoid.rb
mongoid-compatibility-0.3.1 spec/support/mongoid.rb