Skip to content

Instantly share code, notes, and snippets.

@timonv
Last active February 19, 2016 01:40
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save timonv/7026067 to your computer and use it in GitHub Desktop.
Save timonv/7026067 to your computer and use it in GitHub Desktop.
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.clean_with :truncation
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
# Force the driver to wait till the page finishes loading
config.after(:each, js: true) do
current_path.should == current_path
end
config.after(:each) do
DatabaseCleaner.clean
end
@rmontgomery429
Copy link

BTW, @jnicklas also suggests using an :around block for database cleaning. teamcapybara/capybara#1089 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment