提交 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
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册