What is the difference between the following?
- DatabaseCleaner.clean_with(:truncation)
- DatabaseCleaner.clean
What i'm trying to figure out is what is the best way to clean up a before(:all) hook in my tests (performance wise) using database cleaner. My before(:all) hook just creates a ton of factories and creates some associations between them. Currently, i'm just loading them all in a before(:each) not having to worry about the cleanup afterwards.
My current strategy looks like:
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do |example|
DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
So in addition to my previous question, what should my after(:all) look like?