Skip to content

Instantly share code, notes, and snippets.

@julik
Created November 1, 2011 18:27
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julik/1331449 to your computer and use it in GitHub Desktop.
Save julik/1331449 to your computer and use it in GitHub Desktop.
Transactional database in Minitest in 7 lines of code
module TransactionalTests
# See minitest doco - use_transactional_fixtures_but_in_ruby
# to use include this into your test case
def run(runner)
test_result = nil
ActiveRecord::Base.transaction { test_result = super; raise ActiveRecord::Rollback }
test_result
end
end
@grosser
Copy link

grosser commented Dec 7, 2012

saved my day!

@elijahsmith
Copy link

where do you put this and how do you include it?

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