aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorRyan Bates <ryan@railscasts.com>2008-10-28 17:31:33 -0500
committerJoshua Peek <josh@joshpeek.com>2008-10-28 17:31:33 -0500
commit4ad5aa9a39a83863331a7665407dac475855765b (patch)
treef5002e97e755b3bac25988562ed79ebc72c92f68 /actionpack/test
parent4684e76aefca2c49d3421e7184a1d568e2cc0dac (diff)
downloadrails-4ad5aa9a39a83863331a7665407dac475855765b.tar.gz
rails-4ad5aa9a39a83863331a7665407dac475855765b.tar.bz2
rails-4ad5aa9a39a83863331a7665407dac475855765b.zip
Ensure @content_for_* is checked before yielding to block in render :layout [#8994 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/fixtures/layouts/_column.html.erb2
-rw-r--r--actionpack/test/fixtures/test/nested_layout.erb3
-rw-r--r--actionpack/test/template/render_test.rb10
3 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/test/fixtures/layouts/_column.html.erb b/actionpack/test/fixtures/layouts/_column.html.erb
new file mode 100644
index 0000000000..96db002b8a
--- /dev/null
+++ b/actionpack/test/fixtures/layouts/_column.html.erb
@@ -0,0 +1,2 @@
+<div id="column"><%= yield :column %></div>
+<div id="content"><%= yield %></div> \ No newline at end of file
diff --git a/actionpack/test/fixtures/test/nested_layout.erb b/actionpack/test/fixtures/test/nested_layout.erb
new file mode 100644
index 0000000000..7b6dcbb6c7
--- /dev/null
+++ b/actionpack/test/fixtures/test/nested_layout.erb
@@ -0,0 +1,3 @@
+<% content_for :title, "title" -%>
+<% content_for :column do -%>column<% end -%>
+<% render :layout => 'layouts/column' do -%>content<% end -%> \ No newline at end of file
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index 7e4fff3da6..da8c782880 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -162,4 +162,14 @@ class ViewRenderTest < Test::Unit::TestCase
ActionView::Template.register_template_handler :foo, CustomHandler
assert_equal 'source: "Hello, <%= name %>!"', @view.render(:inline => "Hello, <%= name %>!", :locals => { :name => "Josh" }, :type => :foo)
end
+
+ def test_render_with_layout
+ assert_equal %(<title></title>\nHello world!\n),
+ @view.render(:file => "test/hello_world.erb", :layout => "layouts/yield")
+ end
+
+ def test_render_with_nested_layout
+ assert_equal %(<title>title</title>\n<div id="column">column</div>\n<div id="content">content</div>\n),
+ @view.render(:file => "test/nested_layout.erb", :layout => "layouts/yield")
+ end
end