aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorJavan Makhmali <javan@javan.us>2018-03-18 09:59:47 -0400
committerJavan Makhmali <javan@javan.us>2018-03-20 06:33:20 -0400
commitf4eb2e23a8f61e2766fb32a134bfa6d6b3b7f512 (patch)
tree6530dc71dbb67bbad5dc799f0a698c5573f2724b /actionview/test
parent9d9f752661c31b3063d55bec14e797c957d2bb7d (diff)
downloadrails-f4eb2e23a8f61e2766fb32a134bfa6d6b3b7f512.tar.gz
rails-f4eb2e23a8f61e2766fb32a134bfa6d6b3b7f512.tar.bz2
rails-f4eb2e23a8f61e2766fb32a134bfa6d6b3b7f512.zip
Fix digesting templates with mixed formats
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/fixtures/digestor/comments/show.js.erb1
-rw-r--r--actionview/test/template/digestor_test.rb12
2 files changed, 13 insertions, 0 deletions
diff --git a/actionview/test/fixtures/digestor/comments/show.js.erb b/actionview/test/fixtures/digestor/comments/show.js.erb
new file mode 100644
index 0000000000..38b37dfa2b
--- /dev/null
+++ b/actionview/test/fixtures/digestor/comments/show.js.erb
@@ -0,0 +1 @@
+alert("<%=j render("comments/comment") %>")
diff --git a/actionview/test/template/digestor_test.rb b/actionview/test/template/digestor_test.rb
index 1bfa39a319..ddaa7febb3 100644
--- a/actionview/test/template/digestor_test.rb
+++ b/actionview/test/template/digestor_test.rb
@@ -160,6 +160,18 @@ class TemplateDigestorTest < ActionView::TestCase
assert_equal [:html], tree_template_formats("messages/show").uniq
end
+ def test_template_dependencies_with_fallback_from_js_to_html_format
+ finder.rendered_format = :js
+ assert_equal ["comments/comment"], dependencies("comments/show")
+ end
+
+ def test_template_digest_with_fallback_from_js_to_html_format
+ finder.rendered_format = :js
+ assert_digest_difference("comments/show") do
+ change_template("comments/_comment")
+ end
+ end
+
def test_recursion_in_renders
assert digest("level/recursion") # assert recursion is possible
assert_not_nil digest("level/recursion") # assert digest is stored