1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00
aasm/spec/spec_helpers/mongoid.rb
Guillaume Hain 65073e360a Add support for Nobrainer (RethinkDB)
* Add persistence for NoBrainer
* Add tests for NoBrainer
* Show the ORM version when running the tests
* Add a Dockerfile and a docker-compose.yml file allowing to run from anywhere very easily the test suite with `docker-compose run --rm aasm\'
* Moves the Mongoid database name definition in the gem loader (avoiding code repetition)
* Update the CHANGELOG.md and the README.md files
* Add Rails generator for NoBrainer
2018-02-13 12:49:27 +05:30

26 lines
702 B
Ruby

# encoding: utf-8
begin
require 'mongoid'
puts "mongoid gem found, running mongoid specs \e[32m#{'✔'}\e[0m"
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
rescue LoadError
puts "mongoid gem not found, not running mongoid specs \e[31m#{'✖'}\e[0m"
end