Permalink
Browse files

Added failing test case for changing schema in migration not clearing…

… the prepared statement cache
  • Loading branch information...
1 parent c90a1d2 commit 931775234a522e933f0503236a849936ac3ad702 Joe Van Dyk committed with tenderlove Oct 27, 2011
Showing with 12 additions and 0 deletions.
  1. +12 −0 activerecord/test/cases/query_cache_test.rb
@@ -170,6 +170,18 @@ def test_cache_does_not_wrap_string_results_in_arrays
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)

0 comments on commit 9317752

Please sign in to comment.