Tweaking database_cleaner code
This commit is contained in:
parent
6605689c4f
commit
9e76af5a07
@ -44,13 +44,7 @@ end
|
||||
|
||||
Capybara.default_host = 'test.example.com'
|
||||
|
||||
# How to clean your database when transactions are turned off. See
|
||||
# http://github.com/bmabey/database_cleaner for more info.
|
||||
begin
|
||||
require 'database_cleaner'
|
||||
require 'database_cleaner/cucumber'
|
||||
DatabaseCleaner.strategy = :truncation
|
||||
DatabaseCleaner.orm = "mongoid"
|
||||
rescue LoadError => ignore_if_database_cleaner_not_present
|
||||
puts "Database Cleaner not Present"
|
||||
end
|
||||
require 'database_cleaner'
|
||||
require 'database_cleaner/cucumber'
|
||||
DatabaseCleaner.strategy = :truncation
|
||||
DatabaseCleaner.orm = "mongoid"
|
@ -13,6 +13,20 @@ Rspec.configure do |config|
|
||||
|
||||
config.before(:each) do
|
||||
Locomotive.config.heroku = false
|
||||
Mongoid.master.collections.select { |c| c.name != 'system.indexes' }.each(&:drop)
|
||||
end
|
||||
|
||||
require 'database_cleaner'
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.strategy = :truncation
|
||||
DatabaseCleaner.orm = "mongoid"
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
||||
config.after(:each) do
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user