diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-02 11:17:31 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-02 11:17:31 -0700 |
commit | 4300855e7dccb06017e6d8de203c60497e5a5321 (patch) | |
tree | bf815b267d2b392d08d889ca79a45c7ab9bd3f6a /activerecord/test | |
parent | 3066ea8b44503c16b1a0ad5860ae01470912151a (diff) | |
download | rails-4300855e7dccb06017e6d8de203c60497e5a5321.tar.gz rails-4300855e7dccb06017e6d8de203c60497e5a5321.tar.bz2 rails-4300855e7dccb06017e6d8de203c60497e5a5321.zip |
more tests around caching
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 |