Commit dca1d8d3 by Toby Lawrence

Switch to using MongoDB 3.0 in tests.

Now that we're on MongoDB 3.0 in production, we should also be testing
with MongoDB 3.0.
parent 3b9d1673
...@@ -16,11 +16,11 @@ before_install: ...@@ -16,11 +16,11 @@ before_install:
- elasticsearch-0.90.13/bin/elasticsearch - elasticsearch-0.90.13/bin/elasticsearch
# Run MongoDB as a daemon # Run MongoDB as a daemon
- curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.11.tgz - curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.12.tgz
- tar -zxf mongodb-linux-x86_64-2.6.11.tgz - tar -zxf mongodb-linux-x86_64-3.0.12.tgz
- export PATH=mongodb-linux-x86_64-2.6.11/bin:$PATH - export PATH=mongodb-linux-x86_64-3.0.12/bin:$PATH
- mkdir -p ./mongo/db - mkdir -p ./mongo/db
- mkdir -p ./mongo/log - mkdir -p ./mongo/log
- mongod --fork --dbpath ./mongo/db --logpath ./mongo/log/mongodb.log - mongod --fork --dbpath ./mongo/db --logpath ./mongo/log/mongodb.log --storageEngine wiredTiger
script: bundle exec rspec script: bundle exec rspec
...@@ -40,7 +40,7 @@ gem 'rest-client' ...@@ -40,7 +40,7 @@ gem 'rest-client'
group :test do group :test do
gem 'codecov', :require => false gem 'codecov', :require => false
gem 'database_cleaner', '~> 1.5.1' gem 'mongoid_cleaner', '~> 1.2.0'
gem 'factory_girl', '~> 4.0' gem 'factory_girl', '~> 4.0'
gem 'faker', '~> 1.6' gem 'faker', '~> 1.6'
gem 'guard' gem 'guard'
......
...@@ -42,7 +42,6 @@ GEM ...@@ -42,7 +42,6 @@ GEM
url url
coderay (1.0.7) coderay (1.0.7)
dalli (2.1.0) dalli (2.1.0)
database_cleaner (1.5.1)
delayed_job (4.1.1) delayed_job (4.1.1)
activesupport (>= 3.0, < 5.0) activesupport (>= 3.0, < 5.0)
delayed_job_mongoid (2.2.0) delayed_job_mongoid (2.2.0)
...@@ -85,6 +84,8 @@ GEM ...@@ -85,6 +84,8 @@ GEM
mongoid-compatibility (0.3.1) mongoid-compatibility (0.3.1)
activesupport activesupport
mongoid (>= 2.0) mongoid (>= 2.0)
mongoid_cleaner (1.2.0)
mongoid (>= 4.0)
mongoid_magic_counter_cache (1.1.1) mongoid_magic_counter_cache (1.1.1)
mongoid mongoid
rake rake
...@@ -173,7 +174,6 @@ DEPENDENCIES ...@@ -173,7 +174,6 @@ DEPENDENCIES
bundler bundler
codecov codecov
dalli dalli
database_cleaner (~> 1.5.1)
delayed_job delayed_job
delayed_job_mongoid delayed_job_mongoid
enumerize enumerize
...@@ -184,6 +184,7 @@ DEPENDENCIES ...@@ -184,6 +184,7 @@ DEPENDENCIES
i18n i18n
mongoid (~> 5.0.0) mongoid (~> 5.0.0)
mongoid-tree! mongoid-tree!
mongoid_cleaner (~> 1.2.0)
mongoid_magic_counter_cache mongoid_magic_counter_cache
newrelic_rpm newrelic_rpm
nokogiri (~> 1.6.8) nokogiri (~> 1.6.8)
...@@ -204,3 +205,9 @@ DEPENDENCIES ...@@ -204,3 +205,9 @@ DEPENDENCIES
unicorn unicorn
will_paginate_mongoid (~> 2.0) will_paginate_mongoid (~> 2.0)
yajl-ruby yajl-ruby
RUBY VERSION
ruby 1.9.3p551
BUNDLED WITH
1.12.5
require 'database_cleaner' require 'mongoid_cleaner'
RSpec.configure do |config| RSpec.configure do |config|
config.before(:suite) do config.before(:suite) do
# Mongoid only supports truncation. MongoidCleaner.strategy = :drop
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean_with(:truncation)
end end
config.around(:each) do |example| config.around(:each) do |example|
DatabaseCleaner.cleaning do MongoidCleaner.cleaning do
example.run example.run
end end
end end
......
...@@ -6,11 +6,8 @@ RSpec.configure do |config| ...@@ -6,11 +6,8 @@ RSpec.configure do |config|
FactoryGirl.find_definitions FactoryGirl.find_definitions
config.before(:suite) do config.before(:suite) do
begin MongoidCleaner.cleaning do
DatabaseCleaner.start
FactoryGirl.lint FactoryGirl.lint
ensure
DatabaseCleaner.clean
end end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment