Added failing test case for changing schema in migration not clearing the prepared statement cache

This commit is contained in:
Joe Van Dyk 2011-10-27 08:25:42 -07:00 committed by Aaron Patterson
parent 1ad9138c00
commit 420f7fd507
1 changed files with 12 additions and 0 deletions

View File

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