add support for root keys

remove debugging gem

fix white space
This commit is contained in:
NullVoxPopuli
2014-10-12 21:51:41 -04:00
parent 97023db904
commit 7338b62b02
5 changed files with 54 additions and 15 deletions

View File

@@ -5,7 +5,13 @@ module ActionController
class ImplicitSerializerTest < ActionController::TestCase
class MyController < ActionController::Base
def render_using_implicit_serializer
render json: Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
render json: @profile
end
def render_using_custom_root
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
render json: @profile, root: "custom_root"
end
end
@@ -18,8 +24,13 @@ module ActionController
assert_equal 'application/json', @response.content_type
assert_equal '{"name":"Name 1","description":"Description 1"}', @response.body
end
def test_render_using_custom_root
get :render_using_custom_root
assert_equal 'application/json', @response.content_type
assert_equal '{"custom_root":{"name":"Name 1","description":"Description 1"}}', @response.body
end
end
end
end