Module: Cucumber::Rails
- Defined in:
- lib/cucumber/rails/world.rb
Defined Under Namespace
Classes: World
Class Method Summary collapse
Class Method Details
.use_transactional_fixtures ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/cucumber/rails/world.rb', line 44 def self.use_transactional_fixtures World.use_transactional_fixtures = true if defined?(ActiveRecord::Base) $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 ActionMailer::Base.deliveries = [] if defined?(ActionMailer::Base) 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 end |