Skip to content

Instantly share code, notes, and snippets.

@christos
Forked from felipeelias/spec_helper.rb
Created January 7, 2013 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christos/4476798 to your computer and use it in GitHub Desktop.
Save christos/4476798 to your computer and use it in GitHub Desktop.
RSpec.configure do |config|
config.around do |example|
# For examples using capybara-webkit for example.
# Remove this if you don't use it or anything similar
if example.metadata[:js]
example.run
ActiveRecord::Base.connection.execute("TRUNCATE #{ActiveRecord::Base.connection.tables.join(',')} RESTART IDENTITY")
else
ActiveRecord::Base.transaction do
example.run
raise ActiveRecord::Rollback
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment