diff options
author | Diego Carrion <dc.rec1@gmail.com> | 2010-09-18 11:00:23 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-27 23:11:29 +0200 |
commit | 72f37bd8bc5b3beb1e8a2d1ac2de2c045cd0cfd2 (patch) | |
tree | 012c2c8d99aec0c0f97bfb34c73c010471233d32 /actionpack/test/controller | |
parent | 4966b915fe96db73933d33176c1ea5cc53e58a22 (diff) | |
download | rails-72f37bd8bc5b3beb1e8a2d1ac2de2c045cd0cfd2.tar.gz rails-72f37bd8bc5b3beb1e8a2d1ac2de2c045cd0cfd2.tar.bz2 rails-72f37bd8bc5b3beb1e8a2d1ac2de2c045cd0cfd2.zip |
renderer calls object.to_json when rendering :json => object [#5655 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/render_json_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_json_test.rb b/actionpack/test/controller/render_json_test.rb index 5958b18d80..6dd2a9f23d 100644 --- a/actionpack/test/controller/render_json_test.rb +++ b/actionpack/test/controller/render_json_test.rb @@ -9,6 +9,10 @@ class RenderJsonTest < ActionController::TestCase hash.except!(*options[:except]) if options[:except] hash end + + def to_json(options = {}) + super :except => [:c, :e] + end end class TestController < ActionController::Base @@ -49,6 +53,10 @@ class RenderJsonTest < ActionController::TestCase def render_json_with_extra_options render :json => JsonRenderable.new, :except => [:c, :e] end + + def render_json_without_options + render :json => JsonRenderable.new + end end tests TestController @@ -109,4 +117,9 @@ class RenderJsonTest < ActionController::TestCase assert_equal '{"a":"b"}', @response.body assert_equal 'application/json', @response.content_type end + + def test_render_json_calls_to_json_from_object + get :render_json_without_options + assert_equal '{"a":"b"}', @response.body + end end |