Skip to content

Instantly share code, notes, and snippets.

@tovodeverett
Created June 19, 2013 19:40
Show Gist options
  • Save tovodeverett/5817365 to your computer and use it in GitHub Desktop.
Save tovodeverett/5817365 to your computer and use it in GitHub Desktop.
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