diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/digestor.rb | 4 | ||||
-rw-r--r-- | actionpack/test/fixtures/digestor/messages/_form.html.erb | 0 | ||||
-rw-r--r-- | actionpack/test/fixtures/digestor/messages/edit.html.erb | 4 | ||||
-rw-r--r-- | actionpack/test/template/digestor_test.rb | 23 |
4 files changed, 29 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/digestor.rb b/actionpack/lib/action_view/digestor.rb index cfa864cdd4..58920e1e59 100644 --- a/actionpack/lib/action_view/digestor.rb +++ b/actionpack/lib/action_view/digestor.rb @@ -15,9 +15,9 @@ module ActionView # render(topics) => render("topics/topic") # render(message.topics) => render("topics/topic") RENDER_DEPENDENCY = / - render\s? # render, followed by an optional space + render\s* # render, followed by an optional space \(? # start a optional parenthesis for the render call - (partial:)?\s? # naming the partial, used with collection -- 1st capture + (partial:)?\s* # naming the partial, used with collection -- 1st capture ([@a-z"'][@a-z_\/\."']+) # the template name itself -- 2nd capture /x diff --git a/actionpack/test/fixtures/digestor/messages/_form.html.erb b/actionpack/test/fixtures/digestor/messages/_form.html.erb new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/actionpack/test/fixtures/digestor/messages/_form.html.erb diff --git a/actionpack/test/fixtures/digestor/messages/edit.html.erb b/actionpack/test/fixtures/digestor/messages/edit.html.erb new file mode 100644 index 0000000000..791654ffc9 --- /dev/null +++ b/actionpack/test/fixtures/digestor/messages/edit.html.erb @@ -0,0 +1,4 @@ +<%= render "header" %> +<%= render partial: "form" %> +<%= render @message %> +<%= render ( @message.events ) %> diff --git a/actionpack/test/template/digestor_test.rb b/actionpack/test/template/digestor_test.rb index 067ab500f5..dd9bfbca05 100644 --- a/actionpack/test/template/digestor_test.rb +++ b/actionpack/test/template/digestor_test.rb @@ -92,6 +92,29 @@ class TemplateDigestorTest < ActionView::TestCase end end + def test_extra_whitespace_in_render_partial + assert_digest_difference("messages/edit") do + change_template("messages/_form") + end + end + + def test_extra_whitespace_in_render_named_partial + assert_digest_difference("messages/edit") do + change_template("messages/_header") + end + end + + def test_extra_whitespace_in_render_record + assert_digest_difference("messages/edit") do + change_template("messages/_message") + end + end + + def test_extra_whitespace_in_render_with_parenthesis + assert_digest_difference("messages/edit") do + change_template("events/_event") + end + end private def assert_logged(message) |