Assert serializer-defined types are not inflected

This commit is contained in:
Benjamin Fleischer 2017-10-31 14:31:33 -05:00
parent 82e90091fd
commit 92dde58f5f

View File

@ -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