Permalink
Browse files

Fix render :json => nil [#2589 state:resolved]

  • Loading branch information...
1 parent 00eee49 commit 7c4b325e0a3a73d7910b8cad062d1154d47e225b @jeremy jeremy committed Apr 30, 2009
Showing with 10 additions and 0 deletions.
  1. +10 −0 actionpack/test/controller/render_test.rb
@@ -193,6 +193,10 @@ def accessing_controller_name_in_template
render :inline => "<%= controller_name %>"
end
+ def render_json_nil
+ render :json => nil
+ end
+
def render_json_hello_world
render :json => {:hello => 'world'}.to_json
end
@@ -886,6 +890,12 @@ def test_render_file_from_template
assert_equal "The secret is in the sauce\n", @response.body
end
+ def test_render_json_nil
+ get :render_json_nil
+ assert_equal 'null', @response.body
+ assert_equal 'application/json', @response.content_type
+ end
+
def test_render_json
get :render_json_hello_world
assert_equal '{"hello": "world"}', @response.body

0 comments on commit 7c4b325

Please sign in to comment.