diff options
author | Ignatius Reza <lyoneil.de.sire@gmail.com> | 2016-07-21 08:35:55 +0900 |
---|---|---|
committer | Ignatius Reza <lyoneil.de.sire@gmail.com> | 2016-07-21 08:42:56 +0900 |
commit | 714c763dad908d6f70df978f7bb1de950b382d67 (patch) | |
tree | 1bc639fa603601c7f90a285e3e34d0c19060654e /actionpack/test | |
parent | b334c19c0746fce218faf73bbb8594915fdfcf0a (diff) | |
download | rails-714c763dad908d6f70df978f7bb1de950b382d67.tar.gz rails-714c763dad908d6f70df978f7bb1de950b382d67.tar.bz2 rails-714c763dad908d6f70df978f7bb1de950b382d67.zip |
Bring back support for callable cache_key on collection rendering
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/caching_test.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 7faf3cd8c6..9c2619dc3d 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -393,9 +393,14 @@ class CollectionCacheController < ActionController::Base @customers = [Customer.new('david', 1)] render partial: 'customers/commented_customer', collection: @customers, as: :customer, cached: true end + + def index_with_callable_cache_key + @customers = [Customer.new('david', 1)] + render partial: 'customers/customer', collection: @customers, cached: -> customer { 'cached_david' } + end end -class AutomaticCollectionCacheTest < ActionController::TestCase +class CollectionCacheTest < ActionController::TestCase def setup super @controller = CollectionCacheController.new @@ -438,6 +443,11 @@ class AutomaticCollectionCacheTest < ActionController::TestCase assert_equal 1, @controller.partial_rendered_times end + def test_caching_with_callable_cache_key + get :index_with_callable_cache_key + assert_customer_cached 'cached_david', 'david, 1' + end + private def assert_customer_cached(key, content) assert_match content, |