test/handler_test.rb in express_templates-0.9.3 vs test/handler_test.rb in express_templates-0.9.4

- old
+ new

@@ -119,6 +119,30 @@ test "helpers returning html work in sequence within a block" do @template = new_template("li { link_helper ; link_helper } ") assert_equal "<li>\n#{A_LINK}#{A_LINK}</li>\n", render end + test "raises warning if template has conditional logic" do + temp = "dd(class: 'date') { + if blog_post.publish_at + blog_post.publish_at + else + link_to('Edit', '#'') + end + }" + keywords = %w(if unless until case for do loop while) + tokens = [] + + if Ripper.lex(temp).select do |element| + element[1]==:on_kw + end.each { |match| tokens.push(match) if keywords.include? match[2] } + tokens.each do |first| + out, @err = capture_io do + warn 'foo' + end + end + end + + assert_equal @err, "foo\n" + end + end \ No newline at end of file