diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2015-09-26 23:06:56 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-09-26 23:06:56 +0200 |
commit | 1d02cba939965272483a4bed8fe3d7dbabeafdaf (patch) | |
tree | dcbebc0ae362192dd5b5678abbe02330e64dfac5 | |
parent | ee824c8858f2a14aa3014877310971795348e460 (diff) | |
parent | 5e32b90245063c9644627e96f6e6df73aa19d7f0 (diff) | |
download | rails-1d02cba939965272483a4bed8fe3d7dbabeafdaf.tar.gz rails-1d02cba939965272483a4bed8fe3d7dbabeafdaf.tar.bz2 rails-1d02cba939965272483a4bed8fe3d7dbabeafdaf.zip |
Merge pull request #21781 from ronakjangir47/partial_caching_test
Added test cases where collection partial cached & rendered with different keys
-rw-r--r-- | actionview/test/template/render_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 9c2c9507b7..00fc28a522 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -627,6 +627,16 @@ class CachedCollectionViewRenderTest < CachedViewRenderTest @view.render(partial: "test/customer", collection: [customer], cache: ->(item) { [item, 'key'] }) end + test "with caching with custom key and rendering with different key" do + customer = Customer.new("david") + key = cache_key([customer, 'key'], "test/_customer") + + ActionView::PartialRenderer.collection_cache.write(key, 'Hello') + + assert_equal "Hello: david", + @view.render(partial: "test/customer", collection: [customer], cache: ->(item) { [item, 'another_key'] }) + end + test "automatic caching with inferred cache name" do customer = CachedCustomer.new("david") key = cache_key(customer, "test/_cached_customer") |