Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

elijahsmith commented Dec 8, 2012

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