aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorVipul A M <vipulnsward@gmail.com>2013-07-29 01:12:34 +0530
committerVipul A M <vipulnsward@gmail.com>2013-12-03 17:48:14 +0530
commit1ed81e85ca1d2518400b56c167f3c196c51afede (patch)
treef35ba3e98f3fe87ea55a8630f5c45f27a72ccd3e /activerecord/test
parentb6f189e2f0bcc8f36f52c83e8ac2255d5e578a42 (diff)
downloadrails-1ed81e85ca1d2518400b56c167f3c196c51afede.tar.gz
rails-1ed81e85ca1d2518400b56c167f3c196c51afede.tar.bz2
rails-1ed81e85ca1d2518400b56c167f3c196c51afede.zip
Currently, we clear query_cache in cache block finish, even if we may already have cache true.
This commit takes into account the last cache_enabled value, before clearing query_cache.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/query_cache_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb
index 136fda664c..5566563116 100644
--- a/activerecord/test/cases/query_cache_test.rb
+++ b/activerecord/test/cases/query_cache_test.rb
@@ -134,6 +134,15 @@ class QueryCacheTest < ActiveRecord::TestCase
end
end
+ def test_find_queries_with_multi_cache_blocks
+ Task.cache do
+ Task.cache do
+ assert_queries(2) { Task.find(1); Task.find(2) }
+ end
+ assert_queries(0) { Task.find(1); Task.find(1); Task.find(2) }
+ end
+ end
+
def test_count_queries_with_cache
Task.cache do
assert_queries(1) { Task.count; Task.count }