Created
December 21, 2012 05:58
-
-
Save jhollinger/4350949 to your computer and use it in GitHub Desktop.
Optimal RSpec Database Cleaner config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Capybara.javascript_driver = :webkit # Selenium works, but not as well | |
RSpec.configure do |config| | |
config.use_transactional_fixtures = false | |
# Use transactions by default | |
config.before :each do | |
DatabaseCleaner.strategy = :transaction | |
end | |
# For the javascript-enabled tests, switch to truncation, but *only on tables that were used* | |
config.before :each, :js => true do | |
DatabaseCleaner.strategy = :truncation, {:pre_count => true} | |
end | |
config.before :each do | |
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