From 420f7fd507fd5868adc1e0398c2422aac16d2013 Mon Sep 17 00:00:00 2001 From: Joe Van Dyk Date: Thu, 27 Oct 2011 08:25:42 -0700 Subject: Added failing test case for changing schema in migration not clearing the prepared statement cache --- activerecord/test/cases/query_cache_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'activerecord/test/cases/query_cache_test.rb') diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index b2429d631f..9554386dcf 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -170,6 +170,18 @@ end class QueryCacheExpiryTest < ActiveRecord::TestCase fixtures :tasks, :posts, :categories, :categories_posts + def test_cache_gets_cleared_after_migration + # warm the cache + Post.find(1) + + # change the column definition + Post.connection.change_column :posts, :title, :string, :limit => 80 + assert_nothing_raised { Post.find(1) } + + # restore the old definition + Post.connection.change_column :posts, :title, :string + end + def test_find Task.connection.expects(:clear_query_cache).times(1) -- cgit v1.2.3