Permalink
Browse files

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

  • Loading branch information...
1 parent 21bad74 commit 17f2499f04ff154ddd673f5522158fd01e9e054e Christos Zisopoulos committed Aug 30, 2012
@@ -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

0 comments on commit 17f2499

Please sign in to comment.