From a8ece12fe2ac7838407954453e0d31af6186a5db Mon Sep 17 00:00:00 2001 From: Ryan Bates Date: Tue, 19 Aug 2008 19:09:04 -0500 Subject: Return nil instead of a space when passing an empty collection or nil to 'render :partial' [#791 state:resolved] Signed-off-by: Joshua Peek --- actionpack/test/template/render_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index 31cfdce531..25bbc263dd 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -87,6 +87,14 @@ class ViewRenderTest < Test::Unit::TestCase @view.render(:partial => "test/local_inspector", :collection => [ Customer.new("mary") ]) end + def test_render_partial_with_empty_collection_should_return_nil + assert_nil @view.render(:partial => "test/customer", :collection => []) + end + + def test_render_partial_with_nil_collection_should_return_nil + assert_nil @view.render(:partial => "test/customer", :collection => nil) + end + # TODO: The reason for this test is unclear, improve documentation def test_render_partial_and_fallback_to_layout assert_equal "Before (Josh)\n\nAfter", @view.render(:partial => "test/layout_for_partial", :locals => { :name => "Josh" }) -- cgit v1.2.3