diff options
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/render_json_test.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/actionpack/test/controller/render_json_test.rb b/actionpack/test/controller/render_json_test.rb index f886af1a95..dc09812ba3 100644 --- a/actionpack/test/controller/render_json_test.rb +++ b/actionpack/test/controller/render_json_test.rb @@ -26,8 +26,12 @@ class RenderJsonTest < ActionController::TestCase end class JsonSerializable + def initialize(skip=false) + @skip = skip + end + def active_model_serializer - JsonSerializer + JsonSerializer unless @skip end def as_json(*) @@ -89,6 +93,11 @@ class RenderJsonTest < ActionController::TestCase @current_user = Struct.new(:as_json).new(:current_user => true) render :json => JsonSerializable.new end + + def render_json_with_serializer_api_but_without_serializer + @current_user = Struct.new(:as_json).new(:current_user => true) + render :json => JsonSerializable.new(true) + end end tests TestController @@ -166,4 +175,9 @@ class RenderJsonTest < ActionController::TestCase assert_match '"scope":{"current_user":true}', @response.body assert_match '"object":{"serializable_object":true}', @response.body end + + def test_render_json_with_serializer_api_but_without_serializer + get :render_json_with_serializer_api_but_without_serializer + assert_match '{"serializable_object":true}', @response.body + end end |