diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-09-21 16:19:42 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-09-21 16:19:42 -0400 |
commit | 6fd9298272518f4a25a1494b1b1c860bda2dd6b4 (patch) | |
tree | a892b48fe674bd0024518a4173708d385bbe3536 /activerecord/test/cases | |
parent | b1223458979adc29117ffa1392526c6a166effed (diff) | |
download | rails-6fd9298272518f4a25a1494b1b1c860bda2dd6b4.tar.gz rails-6fd9298272518f4a25a1494b1b1c860bda2dd6b4.tar.bz2 rails-6fd9298272518f4a25a1494b1b1c860bda2dd6b4.zip |
No private def in the codebase
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/query_cache_test.rb | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index 69be091869..3eb4e04cb7 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -55,16 +55,6 @@ class QueryCacheTest < ActiveRecord::TestCase assert_cache :off end - private def with_temporary_connection_pool - old_pool = ActiveRecord::Base.connection_handler.retrieve_connection_pool(ActiveRecord::Base.connection_specification_name) - new_pool = ActiveRecord::ConnectionAdapters::ConnectionPool.new ActiveRecord::Base.connection_pool.spec - ActiveRecord::Base.connection_handler.send(:owner_to_pool)["primary"] = new_pool - - yield - ensure - ActiveRecord::Base.connection_handler.send(:owner_to_pool)["primary"] = old_pool - end - def test_query_cache_across_threads with_temporary_connection_pool do begin @@ -495,6 +485,17 @@ class QueryCacheTest < ActiveRecord::TestCase end private + + def with_temporary_connection_pool + old_pool = ActiveRecord::Base.connection_handler.retrieve_connection_pool(ActiveRecord::Base.connection_specification_name) + new_pool = ActiveRecord::ConnectionAdapters::ConnectionPool.new ActiveRecord::Base.connection_pool.spec + ActiveRecord::Base.connection_handler.send(:owner_to_pool)["primary"] = new_pool + + yield + ensure + ActiveRecord::Base.connection_handler.send(:owner_to_pool)["primary"] = old_pool + end + def middleware(&app) executor = Class.new(ActiveSupport::Executor) ActiveRecord::QueryCache.install_executor_hooks executor |