Created
June 22, 2012 21:42
-
-
Save denniskuczynski/2975363 to your computer and use it in GitHub Desktop.
spec_helper for changing configuration based on RSpec example options
This file contains 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
config.before(:each) do | |
with_transaction_callbacks = example.options[:with_transaction_callbacks] | |
if with_transaction_callbacks | |
DatabaseCleaner.strategy = :truncation | |
else | |
DatabaseCleaner.strategy = :transaction | |
end | |
DatabaseCleaner.start | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment