diff options
author | José Valim <jose.valim@gmail.com> | 2011-11-25 19:29:39 +0000 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-11-25 19:29:39 +0000 |
commit | 0a4035b12a6c59253cb60f9e3456513c6a6a9d33 (patch) | |
tree | 513faab640a046e21c4b254b25f1bd601590ba2d /actionpack/test/controller | |
parent | 2dab493867d35d27015e3ba00d20ee6d2337320e (diff) | |
download | rails-0a4035b12a6c59253cb60f9e3456513c6a6a9d33.tar.gz rails-0a4035b12a6c59253cb60f9e3456513c6a6a9d33.tar.bz2 rails-0a4035b12a6c59253cb60f9e3456513c6a6a9d33.zip |
Revert the serializers API as other alternatives are now also under discussion
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/render_json_test.rb | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/actionpack/test/controller/render_json_test.rb b/actionpack/test/controller/render_json_test.rb index dc09812ba3..fc604a2db3 100644 --- a/actionpack/test/controller/render_json_test.rb +++ b/actionpack/test/controller/render_json_test.rb @@ -15,36 +15,9 @@ class RenderJsonTest < ActionController::TestCase end end - class JsonSerializer - def initialize(object, scope) - @object, @scope = object, scope - end - - def as_json(*) - { :object => @object.as_json, :scope => @scope.as_json } - end - end - - class JsonSerializable - def initialize(skip=false) - @skip = skip - end - - def active_model_serializer - JsonSerializer unless @skip - end - - def as_json(*) - { :serializable_object => true } - end - end - class TestController < ActionController::Base protect_from_forgery - serialization_scope :current_user - attr_reader :current_user - def self.controller_path 'test' end @@ -88,16 +61,6 @@ class RenderJsonTest < ActionController::TestCase def render_json_without_options render :json => JsonRenderable.new end - - def render_json_with_serializer - @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 @@ -169,15 +132,4 @@ class RenderJsonTest < ActionController::TestCase get :render_json_without_options assert_equal '{"a":"b"}', @response.body end - - def test_render_json_with_serializer - get :render_json_with_serializer - 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 |