spec/spec_helper.rb in mongoid-urls-0.0.3 vs spec/spec_helper.rb in mongoid-urls-0.0.7
- old
+ new
@@ -1,7 +1,11 @@
# require 'codeclimate-test-reporter'
# CodeClimate::TestReporter.start
+if ENV['CI']
+ require 'coveralls'
+ Coveralls.wear!
+end
$LOAD_PATH << File.expand_path('../../lib', __FILE__)
# require 'pry'
# require 'database_cleaner'
@@ -10,23 +14,30 @@
require 'mongoid/urls'
ENV['MONGOID_ENV'] = 'test'
+db_config = {
+ default: {
+ database: 'mongoid_urls_test',
+ hosts: ["localhost: #{ENV['MONGODB_PORT'] || 27_017}"],
+ options: {}
+ }
+}
+
Mongoid.configure do |config|
config.load_configuration(
- clients: {
- default: {
- database: 'mongoid_urls_test',
- hosts: ["localhost: #{ENV['BOXEN_MONGODB_PORT'] || 27_017}"],
- options: {}
- }
- })
+ if Mongoid::VERSION >= '5'
+ { clients: db_config }
+ else
+ { sessions: db_config }
+ end
+ )
end
require 'support/models'
-Mongo::Logger.logger.level = Logger::INFO
+Mongo::Logger.logger.level = Logger::INFO if Mongoid::VERSION >= '5'
RSpec.configure do |config|
config.include Mongoid::Matchers
config.before(:each) do