diff options
author | Tobias Lütke <tobias.luetke@gmail.com> | 2007-02-20 23:42:04 +0000 |
---|---|---|
committer | Tobias Lütke <tobias.luetke@gmail.com> | 2007-02-20 23:42:04 +0000 |
commit | b5419cd66ea160d1ee94f3ca521bb44adf3a21ca (patch) | |
tree | 79ffdd2411ff623542c9c5a1779dad9f980843b5 /activerecord/test | |
parent | e1056530665d5c8eed2c325157fbb88553eb2678 (diff) | |
download | rails-b5419cd66ea160d1ee94f3ca521bb44adf3a21ca.tar.gz rails-b5419cd66ea160d1ee94f3ca521bb44adf3a21ca.tar.bz2 rails-b5419cd66ea160d1ee94f3ca521bb44adf3a21ca.zip |
You can now use cache in instance hierachies. This allows ActiveRecord::Base.cache { } usage to cache everything
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6179 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/query_cache_test.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/activerecord/test/query_cache_test.rb b/activerecord/test/query_cache_test.rb index 5326351483..1ede03e70e 100644 --- a/activerecord/test/query_cache_test.rb +++ b/activerecord/test/query_cache_test.rb @@ -3,10 +3,8 @@ require 'fixtures/topic' require 'fixtures/reply' require 'fixtures/task' - class QueryCacheTest < Test::Unit::TestCase fixtures :tasks - def test_find_queries assert_queries(2) { Task.find(1); Task.find(1) } @@ -23,14 +21,32 @@ class QueryCacheTest < Test::Unit::TestCase assert_queries(1) { Task.find(1); Task.find(1) } end end + + def test_query_cache_returned + assert_not_equal ActiveRecord::QueryCache, Task.connection.class + Task.cache do + assert_equal ActiveRecord::QueryCache, Task.connection.class + end + end + def test_cache_is_scoped_on_actual_class_only Task.cache do assert_queries(2) { Topic.find(1); Topic.find(1) } end end + + + def test_cache_is_scoped_on_all_descending_classes + ActiveRecord::Base.cache do + assert_queries(1) { Task.find(1); Task.find(1) } + end + end + + end + uses_mocha('QueryCacheExpiryTest') do class QueryCacheExpiryTest < Test::Unit::TestCase |