aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/render_json_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-02-24 19:17:24 +0100
committerJosé Valim <jose.valim@gmail.com>2010-02-24 22:17:25 +0100
commita39c7505bd69e9da0a122fbb8fe20612390c57ff (patch)
tree591219c470c736e99aafccd76f027bbb0efcf4ed /actionpack/test/controller/render_json_test.rb
parent6a061187e26f0942c458a859c8e941ed092a48c1 (diff)
downloadrails-a39c7505bd69e9da0a122fbb8fe20612390c57ff.tar.gz
rails-a39c7505bd69e9da0a122fbb8fe20612390c57ff.tar.bz2
rails-a39c7505bd69e9da0a122fbb8fe20612390c57ff.zip
Cleanup render callstack and make render(:json => {}, :status => 401) work again.
Diffstat (limited to 'actionpack/test/controller/render_json_test.rb')
-rw-r--r--actionpack/test/controller/render_json_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_json_test.rb b/actionpack/test/controller/render_json_test.rb
index 3938fc7061..2580ada88b 100644
--- a/actionpack/test/controller/render_json_test.rb
+++ b/actionpack/test/controller/render_json_test.rb
@@ -18,6 +18,10 @@ class RenderJsonTest < ActionController::TestCase
render :json => ActiveSupport::JSON.encode(:hello => 'world')
end
+ def render_json_hello_world_with_status
+ render :json => ActiveSupport::JSON.encode(:hello => 'world'), :status => 401
+ end
+
def render_json_hello_world_with_callback
render :json => ActiveSupport::JSON.encode(:hello => 'world'), :callback => 'alert'
end
@@ -58,6 +62,12 @@ class RenderJsonTest < ActionController::TestCase
assert_equal 'application/json', @response.content_type
end
+ def test_render_json_with_status
+ get :render_json_hello_world_with_status
+ assert_equal '{"hello":"world"}', @response.body
+ assert_equal 401, @response.status
+ end
+
def test_render_json_with_callback
get :render_json_hello_world_with_callback
assert_equal 'alert({"hello":"world"})', @response.body