Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove useless check of AR being defined from teardown fixtures

We are already in the AR namespace, there's no way for it to be
undefined. See the cousin commit 13e72db

Refactor a bit teardown fixtures to avoid two conditionals.
  • Loading branch information...
commit 462a90565cd9bdecbaaf0b9d9b1ff2f66bebb8f1 1 parent 8df46ea
@carlosantoniodasilva carlosantoniodasilva authored
Showing with 4 additions and 5 deletions.
  1. +4 −5 activerecord/lib/active_record/fixtures.rb
View
9 activerecord/lib/active_record/fixtures.rb
@@ -872,11 +872,7 @@ def setup_fixtures
end
def teardown_fixtures
- return unless defined?(ActiveRecord) && !ActiveRecord::Base.configurations.blank?
-
- unless run_in_transaction?
- ActiveRecord::FixtureSet.reset_cache
- end
+ return if ActiveRecord::Base.configurations.blank?
# Rollback changes if a transaction is active.
if run_in_transaction?
@@ -884,7 +880,10 @@ def teardown_fixtures
connection.rollback_transaction if connection.transaction_open?
end
@fixture_connections.clear
+ else
+ ActiveRecord::FixtureSet.reset_cache
end
+
ActiveRecord::Base.clear_active_connections!
end
Please sign in to comment.
Something went wrong with that request. Please try again.