Skip to content

Commit

Permalink
Added failing test case for changing schema in migration not clearing…
Browse files Browse the repository at this point in the history
… the prepared statement cache
  • Loading branch information
Joe Van Dyk authored and tenderlove committed Oct 27, 2011
1 parent c90a1d2 commit 9317752
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions activerecord/test/cases/query_cache_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 9317752

Please sign in to comment.