1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

No private def in the codebase

This commit is contained in:
Rafael Mendonça França 2018-09-21 16:19:42 -04:00
parent b122345897
commit 6fd9298272
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
2 changed files with 16 additions and 13 deletions

View file

@ -43,9 +43,11 @@ module ActiveRecord
}
class StatementPool < ConnectionAdapters::StatementPool # :nodoc:
private def dealloc(stmt)
stmt.close
end
private
def dealloc(stmt)
stmt.close
end
end
def initialize(connection, logger, connection_options, config)

View file

@ -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