diff options
Diffstat (limited to 'actionview/test/template/digestor_test.rb')
-rw-r--r-- | actionview/test/template/digestor_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/actionview/test/template/digestor_test.rb b/actionview/test/template/digestor_test.rb index a06f681eda..e39d6ae810 100644 --- a/actionview/test/template/digestor_test.rb +++ b/actionview/test/template/digestor_test.rb @@ -22,6 +22,12 @@ class FixtureFinder < ActionView::LookupContext end end +class ActionView::Digestor::Node + def flatten + [self] + children.flat_map(&:flatten) + end +end + class TemplateDigestorTest < ActionView::TestCase def setup @cwd = Dir.pwd @@ -148,6 +154,17 @@ class TemplateDigestorTest < ActionView::TestCase assert_equal nested_deps, nested_dependencies("messages/show") end + def test_nested_template_deps_with_non_default_rendered_format + finder.rendered_format = nil + nested_deps = [{"comments/comments"=>["comments/comment"]}] + assert_equal nested_deps, nested_dependencies("messages/thread") + end + + def test_template_formats_of_nested_deps_with_non_default_rendered_format + finder.rendered_format = nil + assert_equal [:json, :json, :json], tree_template_formats("messages/thread") + end + def test_recursion_in_renders assert digest("level/recursion") # assert recursion is possible assert_not_nil digest("level/recursion") # assert digest is stored @@ -334,6 +351,11 @@ class TemplateDigestorTest < ActionView::TestCase tree.children.map(&:to_dep_map) end + def tree_template_formats(template_name) + tree = ActionView::Digestor.tree(template_name, finder) + tree.flatten.map(&:template).flat_map(&:formats) + end + def disable_resolver_caching old_caching, ActionView::Resolver.caching = ActionView::Resolver.caching, false yield |