File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class JsonifyBuilder < Template::Handler
1010 def compile ( template )
1111 "json = ::Jsonify::Builder.new(:format => :#{ jsonify_format } );" +
1212 template . source +
13- ";json .compile!;"
13+ ";\n json .compile!;"
1414 end
1515
1616 private
@@ -29,7 +29,7 @@ def default_format
2929 def self . call ( template )
3030 "json = ::Jsonify::Builder.new(:format => :#{ jsonify_format } );" +
3131 template . source +
32- ";json .compile!;"
32+ ";\n json .compile!;"
3333 end
3434
3535 private
Original file line number Diff line number Diff line change 1111 ViewTemplate . new ( "json.hello 'world'" )
1212 end
1313
14+ let ( :template_with_trailing_comment ) do
15+ ViewTemplate . new ( "json.hello 'world' #trailing comment" )
16+ end
17+
1418 context "#{ Rails . version } " do
1519 before do
1620 Rails . stub_chain ( :application , :config , :jsonify_format ) . and_return ( :plain )
2529 result . should == '{"hello":"world"}'
2630 end
2731
32+ it 'should ignore trailing comments' do
33+ result = eval ( Handler . call template_with_trailing_comment )
34+ result . should == '{"hello":"world"}'
35+ end
36+
2837 describe 'when configured with ' do
2938 def expect_format ( format )
3039 Jsonify ::Builder . should_receive ( :new ) . with ( { :format => format } ) . and_return ( double ( "json" ) . as_null_object )
You can’t perform that action at this time.
0 commit comments