Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Modified version of Avdi Grimm's solution for configuring RSpec and Capybara to use DatabaseCleaner
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = Capybara.current_driver == :rack_test ? :transaction : :truncation
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.