Added the test cases for content_for?

Signed-off-by: Ilya Shindyapin <ilya@shindyapin.com>
This commit is contained in:
Ilya Shindyapin 2011-12-15 16:27:19 -05:00
parent 51d91acdcd
commit 4422a1ad7c
5 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,3 @@
<% if content_for? :foo %>
<%= yield_content :foo %>
<% end %>

View File

@ -0,0 +1,3 @@
<% if content_for? :foo %>
<%= yield_content :foo %>
<% end %>

View File

@ -0,0 +1,2 @@
- if content_for? :foo
= yield_content :foo

View File

@ -0,0 +1,2 @@
- if content_for? :foo
= yield_content :foo

View File

@ -138,6 +138,18 @@ describe Sinatra::ContentFor do
render(inner, :passes_values).should == "<i>1</i>2"
end
end
describe "with content_for? in Ruby" do
it 'renders block if key is set' do
content_for(:foo) { "foot" }
render(inner, :footer).should == "foot"
end
it 'does not render a block if different key' do
content_for(:different_key) { "foot" }
render(inner, :footer).should be_empty
end
end
engines.each do |outer|
describe "with yield_content in #{outer.capitalize}" do