Transactional Unit Tests #1

tadman opened this Issue Aug 9, 2010 · 1 comment

2 participants


With ActiveRecord missing, the transactional_fixtures feature must be disabled, but this has the side-effect of turning off transactions for unit tests.

I've searched for a method to re-engage this with no luck, so as an alternative I've created a quick work-around that wraps the test runner in a transaction that's rolled back:


For RSpec 2 this can be done by adding an around block...

around(:each) do |example|
  Sequel::DATABASES.first.transaction do
    raise Sequel::Error::Rollback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment