From 4f77982e213e31d9c6e7195c7db86429b8092744 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 13 Feb 2019 17:08:42 -0800 Subject: Add a test that writes to the collection cache --- actionview/test/template/render_test.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'actionview/test/template') diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 5068e00c7d..8d28f71585 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -743,10 +743,17 @@ class CachedCollectionViewRenderTest < ActiveSupport::TestCase end teardown do - GC.start I18n.reload! end + test "template body written to cache" do + customer = Customer.new("david", 1) + key = cache_key(customer, "test/_customer") + assert_nil ActionView::PartialRenderer.collection_cache.read(key) + @view.render(partial: "test/customer", collection: [customer], cached: true) + assert_equal "Hello: david", ActionView::PartialRenderer.collection_cache.read(key) + end + test "collection caching does not cache by default" do customer = Customer.new("david", 1) key = cache_key(customer, "test/_customer") -- cgit v1.2.3 From d0733ba8c0528aa4bc6e890e189afaac62ebe58f Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 13 Feb 2019 17:17:48 -0800 Subject: Move inline rendering content-type test to a controller test This commit is to remove direct access to the "rendered_format" attribute on the lookup context. "rendered_format" is an implementation detail that we shouldn't test directly. --- actionview/test/template/render_test.rb | 5 ----- 1 file changed, 5 deletions(-) (limited to 'actionview/test/template') diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 8d28f71585..ee8a110b44 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -69,11 +69,6 @@ module RenderTestCases assert_match "No Comment", @view.render(template: "comments/empty", formats: [:xml]) end - def test_rendered_format_without_format - @view.render(inline: "test") - assert_equal :html, @view.lookup_context.rendered_format - end - def test_render_partial_implicitly_use_format_of_the_rendered_template @view.lookup_context.formats = [:json] assert_equal "Hello world", @view.render(template: "test/one", formats: [:html]) -- cgit v1.2.3