Displaying 2 results from an estimated 2 matches for "open_transactions".
2007 Oct 08
3
test not rolling back
...s.rb
that deals with this is :
def teardown_with_fixtures
return unless defined?(ActiveRecord::Base) && !
ActiveRecord::Base.configurations.blank?
# Rollback changes if a transaction is active.
if use_transactional_fixtures? &&
Thread.current[''open_transactions''] != 0
ActiveRecord::Base.connection.rollback_db_transaction
Thread.current[''open_transactions''] = 0
end
ActiveRecord::Base.verify_active_connections!
end
and I found that Thread.current[''open_transactions''] equ...
2008 Mar 14
0
Adding before / after blocks to every spec
...merb that will run all
specs within an ActiveRecord (initially) database transaction - to
give functionality similar to rails transactional fixtures.
Here is the module:
module Merb
module Test
module TransactionalSpecs
def begin_transaction
ActiveRecord::Base.send :increment_open_transactions
ActiveRecord::Base.connection.begin_db_transaction
end
def rollback_transaction
if Thread.current[''open_transactions''] != 0
ActiveRecord::Base.connection.rollback_db_transaction
Thread.current[''open_transactions'']...