8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/merb_cucumber/helpers/activerecord.rb', line 8
def use_transactional_fixtures
$main.Before do
if ::ActiveRecord::Base.connection.respond_to?(:increment_open_transactions)
::ActiveRecord::Base.connection.increment_open_transactions
else
::ActiveRecord::Base.send :increment_open_transactions
end
::ActiveRecord::Base.connection.begin_db_transaction
end
$main.After do
::ActiveRecord::Base.connection.rollback_db_transaction
if ::ActiveRecord::Base.connection.respond_to?(:decrement_open_transactions)
::ActiveRecord::Base.connection.decrement_open_transactions
else
::ActiveRecord::Base.send :decrement_open_transactions
end
end
end
|