aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2019-02-15 17:10:28 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2019-02-15 17:27:33 -0800
commit1581cab9ff26731ed03a17f7ddec3c85d536988a (patch)
tree3691cb09659fcd6b3e140926b07ddd589dad4a41 /actionview/test/activerecord
parent3aa3c0684d3bd748be9e85d25616a8a7a1ab7755 (diff)
downloadrails-1581cab9ff26731ed03a17f7ddec3c85d536988a.tar.gz
rails-1581cab9ff26731ed03a17f7ddec3c85d536988a.tar.bz2
rails-1581cab9ff26731ed03a17f7ddec3c85d536988a.zip
Pass the template format to the digestor
This commit passes the template format to the digestor in order to come up with a key. Before this commit, the digestor would depend on the side effect of the template renderer setting the rendered_format on the lookup context. I would like to remove that mutation, so I've changed this to pass the template format in to the digestor. I've introduced a new instance variable that will be alive during a template render. When the template is being rendered, it pushes the current template on to a stack, setting `@current_template` to the template currently being rendered. When the cache helper asks the digestor for a key, it uses the format of the template currently on the stack.
Diffstat (limited to 'actionview/test/activerecord')
-rw-r--r--actionview/test/activerecord/relation_cache_test.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionview/test/activerecord/relation_cache_test.rb b/actionview/test/activerecord/relation_cache_test.rb
index a6befc3ee5..6fe83dcb9a 100644
--- a/actionview/test/activerecord/relation_cache_test.rb
+++ b/actionview/test/activerecord/relation_cache_test.rb
@@ -11,13 +11,14 @@ class RelationCacheTest < ActionView::TestCase
lookup_context = ActionView::LookupContext.new(view_paths, {}, ["test"])
@view_renderer = ActionView::Renderer.new(lookup_context)
@virtual_path = "path"
+ @current_template = lookup_context.find "test/hello_world"
controller.cache_store = ActiveSupport::Cache::MemoryStore.new
end
def test_cache_relation_other
cache(Project.all) { concat("Hello World") }
- assert_equal "Hello World", controller.cache_store.read("views/path/projects-#{Project.count}")
+ assert_equal "Hello World", controller.cache_store.read("views/test/hello_world:fa9482a68ce25bf7589b8eddad72f736/projects-#{Project.count}")
end
def view_cache_dependencies; []; end