Removing/Updating tests based on new FlattenJson adapter

This commit is contained in:
João Moura
2015-06-18 19:18:11 -03:00
parent 867d36a3a3
commit f67fd976ec
2 changed files with 6 additions and 51 deletions

View File

@@ -9,20 +9,6 @@ module ActionController
render json: @profile
end
def render_using_custom_root
with_adapter ActiveModel::Serializer::Adapter::Json do
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
render json: @profile, root: "custom_root"
end
end
def render_using_custom_root_and_meta
with_adapter ActiveModel::Serializer::Adapter::Json do
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
render json: @profile, root: "custom_root", meta: { total: 10 }
end
end
def render_using_default_adapter_root
with_adapter ActiveModel::Serializer::Adapter::JsonApi do
# JSON-API adapter sets root by default
@@ -31,22 +17,6 @@ module ActionController
end
end
def render_using_custom_root_in_adapter_with_a_default
# JSON-API adapter sets root by default
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
render json: @profile, root: "profile", adapter: :json_api
end
def render_array_using_custom_root_and_meta
with_adapter ActiveModel::Serializer::Adapter::Json do
array = [
Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' }),
Profile.new({ name: 'Name 2', description: 'Description 2', comments: 'Comments 2' })
]
render json: array, root: "custom_root", meta: { total: 10 }
end
end
def render_array_using_implicit_serializer
array = [
Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' }),
@@ -191,24 +161,6 @@ module ActionController
assert_equal expected.to_json, @response.body
end
def test_render_using_custom_root_in_adapter_with_a_default
get :render_using_custom_root_in_adapter_with_a_default
expected = {
data: {
id: assigns(:profile).id.to_s,
type: "profiles",
attributes: {
name: "Name 1",
description: "Description 1"
}
}
}
assert_equal 'application/json', @response.content_type
assert_equal expected.to_json, @response.body
end
def test_render_array_using_implicit_serializer
get :render_array_using_implicit_serializer
assert_equal 'application/json', @response.content_type