Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

… the prepared statement cache
  • Loading branch information...
commit 420f7fd507fd5868adc1e0398c2422aac16d2013 1 parent 1ad9138
@joevandyk joevandyk authored tenderlove committed
Showing with 12 additions and 0 deletions.
  1. +12 −0 activerecord/test/cases/query_cache_test.rb
View
12 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)
Please sign in to comment.
Something went wrong with that request. Please try again.