spec/spec_helper.rb in mongoid-rspec-3.0.0 vs spec/spec_helper.rb in mongoid-rspec-4.0.0

- old
+ new

@@ -1,25 +1,25 @@ $LOAD_PATH.unshift(File.dirname(__FILE__)) -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib")) -MODELS = File.join(File.dirname(__FILE__), "models") +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib')) +MODELS = File.join(File.dirname(__FILE__), 'models') $LOAD_PATH.unshift(MODELS) -VALIDATORS = File.join(File.dirname(__FILE__), "validators") +VALIDATORS = File.join(File.dirname(__FILE__), 'validators') $LOAD_PATH.unshift(VALIDATORS) -require "rubygems" -require "bundler" +require 'rubygems' +require 'bundler' Bundler.setup require 'mongoid' require 'rspec' require 'rspec/core' require 'rspec/expectations' +require 'mongoid/compatibility' -Mongoid.configure do |config| - config.connect_to("mongoid-rspec-test") -end +Mongoid::Config.connect_to('mongoid-rspec-test') if Mongoid::Compatibility::Version.mongoid3_or_newer? +Mongo::Logger.logger.level = ::Logger::INFO if Mongoid::Compatibility::Version.mongoid5_or_newer? -Dir[ File.join(MODELS, "*.rb") ].sort.each { |file| require File.basename(file) } +Dir[File.join(MODELS, '*.rb')].sort.each { |file| require File.basename(file) } require 'mongoid-rspec' RSpec.configure do |config| config.include RSpec::Matchers