Skip to content

Commit 92dde58

Browse files
committed
Assert serializer-defined types are not inflected
1 parent 82e9009 commit 92dde58

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

test/adapter/json_api/type_test.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def assert_type(resource, expected_type, opts = {})
4848
end
4949
class ResourceIdentifierTest < ActiveSupport::TestCase
5050
class WithDefinedTypeSerializer < ActiveModel::Serializer
51-
type 'with_defined_type'
51+
type 'with_defined_types'
5252
end
5353

5454
class WithDefinedIdSerializer < ActiveModel::Serializer
@@ -71,8 +71,18 @@ def id
7171
end
7272

7373
def test_defined_type
74-
actual = actual_resource_identifier_object(WithDefinedTypeSerializer)
75-
expected = { id: expected_model_id, type: 'with-defined-type' }
74+
actual = with_jsonapi_inflection :plural do
75+
actual_resource_identifier_object(WithDefinedTypeSerializer)
76+
end
77+
expected = { id: expected_model_id, type: 'with-defined-types' }
78+
assert_equal actual, expected
79+
end
80+
81+
def test_defined_type_not_inflected
82+
actual = with_jsonapi_inflection :singular do
83+
actual_resource_identifier_object(WithDefinedTypeSerializer)
84+
end
85+
expected = { id: expected_model_id, type: 'with-defined-types' }
7686
assert_equal actual, expected
7787
end
7888

0 commit comments

Comments
 (0)