2017-02-10 06:39:28 -05:00
|
|
|
# encoding: utf-8
|
2018-01-12 05:41:12 -05:00
|
|
|
|
2017-02-10 06:28:38 -05:00
|
|
|
begin
|
|
|
|
require 'mongoid'
|
|
|
|
puts "mongoid gem found, running mongoid specs \e[32m#{'✔'}\e[0m"
|
2018-01-12 05:41:12 -05:00
|
|
|
|
|
|
|
if Mongoid::VERSION.to_f <= 5
|
|
|
|
Mongoid::Config.sessions = {
|
|
|
|
default: {
|
|
|
|
database: "mongoid_#{Process.pid}",
|
|
|
|
hosts: ["#{ENV['MONGODB_HOST'] || 'localhost'}:" \
|
|
|
|
"#{ENV['MONGODB_PORT'] || 27017}"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Mongoid::Config.send(:clients=, {
|
|
|
|
default: {
|
|
|
|
database: "mongoid_#{Process.pid}",
|
|
|
|
hosts: ["#{ENV['MONGODB_HOST'] || 'localhost'}:" \
|
|
|
|
"#{ENV['MONGODB_PORT'] || 27017}"]
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|
2017-02-10 06:28:38 -05:00
|
|
|
rescue LoadError
|
|
|
|
puts "mongoid gem not found, not running mongoid specs \e[31m#{'✖'}\e[0m"
|
|
|
|
end
|