From a67841eb61f808a965da0d61ea47e2d9810436b0 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 3 Mar 2019 13:08:50 +0900 Subject: Ensure `clear_cache!` clears the prepared statements cache Since #23461, all adapters supports prepared statements, so that clears the prepared statements cache is no longer database specific. Actually, I struggled to identify the cause of random CI failure in #23461, that was missing `@statements.clear` in `clear_cache!`. This extracts `clear_cache!` to ensure the common concerns in the abstract adapter. --- activerecord/test/cases/bind_parameter_test.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/bind_parameter_test.rb b/activerecord/test/cases/bind_parameter_test.rb index 03cc0dffbc..eb8b45431f 100644 --- a/activerecord/test/cases/bind_parameter_test.rb +++ b/activerecord/test/cases/bind_parameter_test.rb @@ -41,6 +41,10 @@ if ActiveRecord::Base.connection.prepared_statements topics = Topic.where(id: 1) assert_equal [1], topics.map(&:id) assert_includes statement_cache, to_sql_key(topics.arel) + + @connection.clear_cache! + + assert_not_includes statement_cache, to_sql_key(topics.arel) end def test_statement_cache_with_query_cache -- cgit v1.2.3