aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template
diff options
context:
space:
mode:
authorRonak Jangir <ronakjangir47@gmail.com>2015-09-26 20:19:31 +0530
committerRonak Jangir <ronakjangir47@gmail.com>2015-09-26 20:19:31 +0530
commit5e32b90245063c9644627e96f6e6df73aa19d7f0 (patch)
tree4e10322cd1548ec6d8e65ec91298c15cde3e9239 /actionview/test/template
parent3c52b2000cbee716b5e449974c312c4fb552f64f (diff)
downloadrails-5e32b90245063c9644627e96f6e6df73aa19d7f0.tar.gz
rails-5e32b90245063c9644627e96f6e6df73aa19d7f0.tar.bz2
rails-5e32b90245063c9644627e96f6e6df73aa19d7f0.zip
Added test cases where collection partial cached for different key and rendered for different key
Diffstat (limited to 'actionview/test/template')
-rw-r--r--actionview/test/template/render_test.rb10
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")