Skip to content

Instantly share code, notes, and snippets.

@mikeraimondi
Created June 29, 2013 00:25
Show Gist options
  • Save mikeraimondi/5889100 to your computer and use it in GitHub Desktop.
Save mikeraimondi/5889100 to your computer and use it in GitHub Desktop.
database_cleaner config for Capybara/RSpec with poltergeist
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.clean
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