diff options
author | José Valim <jose.valim@gmail.com> | 2011-11-23 23:45:27 +0000 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-11-23 23:45:27 +0000 |
commit | 7fcc8c0a1f38c77b12cb6ffe81fb2887e6c60b85 (patch) | |
tree | ac081db672326a11910e9c46d93c9675c83c2e87 /actionpack/test | |
parent | 6da52c617e2a075b9d9e7142786f316d8f2c7930 (diff) | |
download | rails-7fcc8c0a1f38c77b12cb6ffe81fb2887e6c60b85.tar.gz rails-7fcc8c0a1f38c77b12cb6ffe81fb2887e6c60b85.tar.bz2 rails-7fcc8c0a1f38c77b12cb6ffe81fb2887e6c60b85.zip |
Rely solely on active_model_serializer and remove the fancy constant lookup.
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 |