提交 462a9056 编写于 作者: C Carlos Antonio da Silva

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 13e72db7

Refactor a bit teardown fixtures to avoid two conditionals.
上级 8df46eac
...@@ -872,11 +872,7 @@ def setup_fixtures ...@@ -872,11 +872,7 @@ def setup_fixtures
end end
def teardown_fixtures def teardown_fixtures
return unless defined?(ActiveRecord) && !ActiveRecord::Base.configurations.blank? return if ActiveRecord::Base.configurations.blank?
unless run_in_transaction?
ActiveRecord::FixtureSet.reset_cache
end
# Rollback changes if a transaction is active. # Rollback changes if a transaction is active.
if run_in_transaction? if run_in_transaction?
...@@ -884,7 +880,10 @@ def teardown_fixtures ...@@ -884,7 +880,10 @@ def teardown_fixtures
connection.rollback_transaction if connection.transaction_open? connection.rollback_transaction if connection.transaction_open?
end end
@fixture_connections.clear @fixture_connections.clear
else
ActiveRecord::FixtureSet.reset_cache
end end
ActiveRecord::Base.clear_active_connections! ActiveRecord::Base.clear_active_connections!
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册