Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added the test cases for content_for?

Signed-off-by: Ilya Shindyapin <ilya@shindyapin.com>
  • Loading branch information...
commit f541eddc394440f701b5285c1f4870132607f086 1 parent 427e167
@license2e license2e authored
View
3  spec/content_for/footer.erb
@@ -0,0 +1,3 @@
+<% if content_for? :foo %>
+ <%= yield_content :foo %>
+<% end %>
View
3  spec/content_for/footer.erubis
@@ -0,0 +1,3 @@
+<% if content_for? :foo %>
+ <%= yield_content :foo %>
+<% end %>
View
2  spec/content_for/footer.haml
@@ -0,0 +1,2 @@
+- if content_for? :foo
+ = yield_content :foo
View
2  spec/content_for/footer.slim
@@ -0,0 +1,2 @@
+- if content_for? :foo
+ = yield_content :foo
View
12 spec/content_for_spec.rb
@@ -138,6 +138,18 @@ def render(engine, template)
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
Please sign in to comment.
Something went wrong with that request. Please try again.