templates/test_suite.rb in icebreaker-0.1.5 vs templates/test_suite.rb in icebreaker-0.1.6
- old
+ new
@@ -6,11 +6,19 @@
# MongoID Teardown
gsub_file 'spec/spec_helper.rb', /config\.fixture_path/, '# config.fixture_path'
gsub_file 'spec/spec_helper.rb', /config\.use_transactional_fixtures/, '# config.use_transactional_fixtures'
gsub_file 'spec/spec_helper.rb', /end/ do
<<-RUBY
- config.before :each do
- Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)
+
+ # Clean up the database
+ require 'database_cleaner'
+ config.before(:suite) do
+ DatabaseCleaner.strategy = :truncation
+ DatabaseCleaner.orm = "mongoid"
end
+ config.before(:each) do
+ DatabaseCleaner.clean
+ end
+
end
RUBY
end