提交 17f2499f 编写于 作者: C Christos Zisopoulos

`Digestor` can now parse old style hash syntax for `render`

上级 21bad744
......@@ -15,10 +15,10 @@ class Digestor
# render(topics) => render("topics/topic")
# render(message.topics) => render("topics/topic")
RENDER_DEPENDENCY = /
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
([@a-z"'][@a-z_\/\."']+) # the template name itself -- 2nd capture
render\s* # render, followed by an optional space
\(? # start a optional parenthesis for the render call
(partial:|:partial\s+=>)?\s* # naming the partial, used with collection -- 1st capture
([@a-z"'][@a-z_\/\."']+) # the template name itself -- 2nd capture
/x
cattr_accessor(:cache) { Hash.new }
......
......@@ -2,3 +2,4 @@
<%= render partial: "form" %>
<%= render @message %>
<%= render ( @message.events ) %>
<%= render :partial => "comments/comment", :collection => @message.comments %>
......@@ -116,6 +116,12 @@ def test_extra_whitespace_in_render_with_parenthesis
end
end
def test_old_style_hash_in_render_invocation
assert_digest_difference("messages/edit") do
change_template("comments/_comment")
end
end
private
def assert_logged(message)
log = StringIO.new
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册