Module: Protest::Rails::TransactionalTests

Included in:
TestCase
Defined in:
lib/protest/rails.rb

Overview

Wrap all tests in a database transaction.

TODO: make this optional somehow (yet enabled by default) so users of other ORMs don’t run into problems.

Instance Method Summary collapse

Instance Method Details

#run(*args, &block) ⇒ Object



29
30
31
32
33
34
# File 'lib/protest/rails.rb', line 29

def run(*args, &block)
  ActiveRecord::Base.connection.transaction do
    super(*args, &block)
    raise ActiveRecord::Rollback
  end
end