Module: ActiveRecord::TestFixtures
- Defined in:
- lib/onceler/extensions/active_record.rb
Overview
monkey-patch this to not clear connections so that we don’t lose our transactions
Instance Method Summary collapse
Instance Method Details
#teardown_fixtures ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/onceler/extensions/active_record.rb', line 8 def teardown_fixtures if ::Rails.version < "7.2" if run_in_transaction? ActiveSupport::Notifications.unsubscribe(@connection_subscriber) if @connection_subscriber @fixture_connections.each do |connection| connection.rollback_transaction if connection.transaction_open? connection.pool.lock_thread = false end @fixture_connections.clear teardown_shared_connection_pool else ActiveRecord::FixtureSet.reset_cache end else if run_in_transaction? teardown_transactional_fixtures else ActiveRecord::FixtureSet.reset_cache invalidate_already_loaded_fixtures end end end |