spec/plugin/content_for_spec.rb in roda-3.14.0 vs spec/plugin/content_for_spec.rb in roda-3.14.1

- old
+ new

@@ -22,10 +22,16 @@ view(:inline => '<% content_for(:foo, "foo") %>bar', :layout => { :inline => '<%= yield %> <%= content_for(:foo) %>' }) end r.get 'e' do view(:inline => 'a<% content_for :foo do %><% end %>b', :layout => { :inline => 'c<%= yield %>d<%= content_for(:foo) %>e' }) end + r.get 'f' do + view(:inline => 'a<% content_for :foo do "f" end %>b', :layout => { :inline => 'c<%= yield %>d<%= content_for(:foo) %>e' }) + end + r.get 'g' do + view(:inline => 'a<% content_for :foo do "<" + "%= 1 %" + ">" end %>b', :layout => { :inline => 'c<%= yield %>d<%= content_for(:foo) %>e' }) + end end end end it "should be able to set content in template and get that content in the layout" do @@ -40,9 +46,17 @@ body('/b').strip.must_equal "bar foo" end it "should work for an empty content_for" do body('/e').strip.must_equal "cabde" + end + + it "should work when content_for uses a regular block" do + body('/f').strip.must_equal "cabdfe" + end + + it "should use content_for output directly" do + body('/g').strip.must_equal "cabd<%= 1 %>e" end end describe "content_for plugin with multiple calls to the same key" do before do