spec/plugin/content_for_spec.rb in roda-2.14.0 vs spec/plugin/content_for_spec.rb in roda-2.15.0
- old
+ new
@@ -105,6 +105,30 @@
it "should work with alternate rendering engines" do
body.strip.must_equal "bar\nfoo"
body('/a').strip.must_equal "bar\nfoo"
end
end
+
+describe "content_for plugin with multiple calls to the same key" do
+ before do
+ app(:bare) do
+ plugin :render, :views => './spec/views'
+ plugin :content_for
+
+ route do |r|
+ r.root do
+ view(:inline => "<% content_for :foo do %>foo<% end %><% content_for :foo do %>baz<% end %>bar", :layout => { :inline => '<%= yield %> <%= content_for(:foo) %>' })
+ end
+ end
+ end
+ end
+
+ it "should replace with multiple calls to the same key by default" do
+ body.strip.must_equal "bar baz"
+ end
+
+ it "should append with multiple calls to the same key if :append plugin option is used" do
+ app.plugin :content_for, :append => true
+ body.strip.must_equal "bar foobaz"
+ end
+end
end