Permalink
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...
1 parent 8df46ea commit 462a90565cd9bdecbaaf0b9d9b1ff2f66bebb8f1 @carlosantoniodasilva carlosantoniodasilva committed Nov 27, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 activerecord/lib/active_record/fixtures.rb
@@ -872,19 +872,18 @@ 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?
@fixture_connections.each do |connection|
connection.rollback_transaction if connection.transaction_open?
end
@fixture_connections.clear
+ else
+ ActiveRecord::FixtureSet.reset_cache
end
+
ActiveRecord::Base.clear_active_connections!
end

0 comments on commit 462a905

Please sign in to comment.