aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-03-06 15:11:28 -0800
committerJosé Valim <jose.valim@gmail.com>2012-03-06 15:11:28 -0800
commitd87ec9d3108afda28a5744d0b7edd328c3c284d1 (patch)
tree49b986e2899aeda11fc83c78192d5d9843e9e692 /actionpack/test
parentd467351149e80ff203c8d238542f324666421e23 (diff)
parent6e0a763d0047dcaae26fb691757c3407a20e4a84 (diff)
downloadrails-d87ec9d3108afda28a5744d0b7edd328c3c284d1.tar.gz
rails-d87ec9d3108afda28a5744d0b7edd328c3c284d1.tar.bz2
rails-d87ec9d3108afda28a5744d0b7edd328c3c284d1.zip
Merge pull request #5310 from Serabe/layout_for_partials_with_collections
Adds :layout option to render :partial when a collection is given.
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/fixtures/test/_b_layout_for_partial.html.erb1
-rw-r--r--actionpack/test/template/render_test.rb4
2 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/test/fixtures/test/_b_layout_for_partial.html.erb b/actionpack/test/fixtures/test/_b_layout_for_partial.html.erb
new file mode 100644
index 0000000000..e918ba8f83
--- /dev/null
+++ b/actionpack/test/fixtures/test/_b_layout_for_partial.html.erb
@@ -0,0 +1 @@
+<b><%= yield %></b> \ No newline at end of file
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index 7347e15373..122b07d348 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -238,6 +238,10 @@ module RenderTestCases
def test_render_partial_with_nil_values_in_collection
assert_equal "Hello: davidHello: Anonymous", @view.render(:partial => "test/customer", :collection => [ Customer.new("david"), nil ])
end
+
+ def test_render_partial_with_layout_using_collection_and_template
+ assert_equal "<b>Hello: Amazon</b><b>Hello: Yahoo</b>", @view.render(:partial => "test/customer", :layout => 'test/b_layout_for_partial', :collection => [ Customer.new("Amazon"), Customer.new("Yahoo") ])
+ end
def test_render_partial_with_empty_array_should_return_nil
assert_nil @view.render(:partial => [])