mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 23:33:12 +00:00
Use more meaningful model names for tests
This commit is contained in:
@@ -6,7 +6,7 @@ module ActionController
|
||||
class ImplicitSerializerTest < ActionController::TestCase
|
||||
class MyController < ActionController::Base
|
||||
def render_using_implicit_serializer
|
||||
render :json => Model.new(attr1: 'value1', attr2: 'value2', attr3: 'value3')
|
||||
render json: Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,14 +15,14 @@ module ActionController
|
||||
def test_render_using_implicit_serializer
|
||||
get :render_using_implicit_serializer
|
||||
assert_equal 'application/json', @response.content_type
|
||||
assert_equal '{"attr1":"value1","attr2":"value2"}', @response.body
|
||||
assert_equal '{"name":"Name 1","description":"Description 1"}', @response.body
|
||||
end
|
||||
end
|
||||
|
||||
class ImplicitSerializerScopeTest < ActionController::TestCase
|
||||
class MyController < ActionController::Base
|
||||
def render_using_implicit_serializer_and_scope
|
||||
render :json => Model.new(attr1: 'value1', attr2: 'value2', attr3: 'value3')
|
||||
render json: Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
||||
end
|
||||
|
||||
private
|
||||
@@ -37,14 +37,14 @@ module ActionController
|
||||
def test_render_using_implicit_serializer_and_scope
|
||||
get :render_using_implicit_serializer_and_scope
|
||||
assert_equal 'application/json', @response.content_type
|
||||
assert_equal '{"attr1":"value1","attr2":"value2-current_user"}', @response.body
|
||||
assert_equal '{"name":"Name 1","description":"Description 1 - current_user"}', @response.body
|
||||
end
|
||||
end
|
||||
|
||||
class ExplicitSerializerScopeTest < ActionController::TestCase
|
||||
class MyController < ActionController::Base
|
||||
def render_using_implicit_serializer_and_explicit_scope
|
||||
render json: Model.new(attr1: 'value1', attr2: 'value2', attr3: 'value3'), scope: current_admin
|
||||
render json: Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' }), scope: current_admin
|
||||
end
|
||||
|
||||
private
|
||||
@@ -63,14 +63,14 @@ module ActionController
|
||||
def test_render_using_implicit_serializer_and_explicit_scope
|
||||
get :render_using_implicit_serializer_and_explicit_scope
|
||||
assert_equal 'application/json', @response.content_type
|
||||
assert_equal '{"attr1":"value1","attr2":"value2-current_admin"}', @response.body
|
||||
assert_equal '{"name":"Name 1","description":"Description 1 - current_admin"}', @response.body
|
||||
end
|
||||
end
|
||||
|
||||
class OverridingSerializationScopeTest < ActionController::TestCase
|
||||
class MyController < ActionController::Base
|
||||
def render_overriding_serialization_scope
|
||||
render json: Model.new(attr1: 'value1', attr2: 'value2', attr3: 'value3')
|
||||
render json: Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
||||
end
|
||||
|
||||
private
|
||||
@@ -89,7 +89,7 @@ module ActionController
|
||||
def test_render_overriding_serialization_scope
|
||||
get :render_overriding_serialization_scope
|
||||
assert_equal 'application/json', @response.content_type
|
||||
assert_equal '{"attr1":"value1","attr2":"value2-current_admin"}', @response.body
|
||||
assert_equal '{"name":"Name 1","description":"Description 1 - current_admin"}', @response.body
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user