diff options
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/query_cache_test.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index ebe7cae04a..66ec592cca 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -21,7 +21,7 @@ class QueryCacheTest < ActiveRecord::TestCase assert called, 'middleware should delegate' end - def test_middleware + def test_middleware_caches mw = ActiveRecord::QueryCache.new lambda { |env| Task.find 1 Task.find 1 @@ -30,6 +30,15 @@ class QueryCacheTest < ActiveRecord::TestCase mw.call({}) end + def test_cache_enabled_during_call + assert !ActiveRecord::Base.connection.query_cache_enabled, 'cache off' + + mw = ActiveRecord::QueryCache.new lambda { |env| + assert ActiveRecord::Base.connection.query_cache_enabled, 'cache on' + } + mw.call({}) + end + def test_find_queries assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) { Task.find(1); Task.find(1) } end |