Skip to content

Instantly share code, notes, and snippets.

@denniskuczynski
Created June 22, 2012 21:42
Show Gist options
  • Save denniskuczynski/2975363 to your computer and use it in GitHub Desktop.
Save denniskuczynski/2975363 to your computer and use it in GitHub Desktop.
spec_helper for changing configuration based on RSpec example options
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