diff options
author | Ryan Bates <ryan@railscasts.com> | 2008-08-19 19:09:04 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-08-19 19:09:04 -0500 |
commit | a8ece12fe2ac7838407954453e0d31af6186a5db (patch) | |
tree | 5a6cb0a957bebc1da95c1918563db10447cacd26 /actionpack/test | |
parent | 71c4ff07ab4313c1f4781d59ad2f4528f5875665 (diff) | |
download | rails-a8ece12fe2ac7838407954453e0d31af6186a5db.tar.gz rails-a8ece12fe2ac7838407954453e0d31af6186a5db.tar.bz2 rails-a8ece12fe2ac7838407954453e0d31af6186a5db.zip |
Return nil instead of a space when passing an empty collection or nil to 'render :partial' [#791 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/render_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/render_test.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index 1b9b12acc6..3008f5ca03 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -329,7 +329,7 @@ class RenderTest < Test::Unit::TestCase def test_render_text_with_nil get :render_text_with_nil assert_response 200 - assert_equal '', @response.body + assert_equal ' ', @response.body end def test_render_text_with_false 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" }) |