mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Assert serializer-defined types are not inflected
This commit is contained in:
parent
82e90091fd
commit
92dde58f5f
@ -48,7 +48,7 @@ module ActiveModelSerializers
|
|||||||
end
|
end
|
||||||
class ResourceIdentifierTest < ActiveSupport::TestCase
|
class ResourceIdentifierTest < ActiveSupport::TestCase
|
||||||
class WithDefinedTypeSerializer < ActiveModel::Serializer
|
class WithDefinedTypeSerializer < ActiveModel::Serializer
|
||||||
type 'with_defined_type'
|
type 'with_defined_types'
|
||||||
end
|
end
|
||||||
|
|
||||||
class WithDefinedIdSerializer < ActiveModel::Serializer
|
class WithDefinedIdSerializer < ActiveModel::Serializer
|
||||||
@ -71,8 +71,18 @@ module ActiveModelSerializers
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_defined_type
|
def test_defined_type
|
||||||
actual = actual_resource_identifier_object(WithDefinedTypeSerializer)
|
actual = with_jsonapi_inflection :plural do
|
||||||
expected = { id: expected_model_id, type: 'with-defined-type' }
|
actual_resource_identifier_object(WithDefinedTypeSerializer)
|
||||||
|
end
|
||||||
|
expected = { id: expected_model_id, type: 'with-defined-types' }
|
||||||
|
assert_equal actual, expected
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_defined_type_not_inflected
|
||||||
|
actual = with_jsonapi_inflection :singular do
|
||||||
|
actual_resource_identifier_object(WithDefinedTypeSerializer)
|
||||||
|
end
|
||||||
|
expected = { id: expected_model_id, type: 'with-defined-types' }
|
||||||
assert_equal actual, expected
|
assert_equal actual, expected
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user