From 92dde58f5fcb6de03182700088ff7f2e20acc385 Mon Sep 17 00:00:00 2001 From: Benjamin Fleischer Date: Tue, 31 Oct 2017 14:31:33 -0500 Subject: [PATCH] Assert serializer-defined types are not inflected --- test/adapter/json_api/type_test.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/adapter/json_api/type_test.rb b/test/adapter/json_api/type_test.rb index 1b4d64d8..84bfe494 100644 --- a/test/adapter/json_api/type_test.rb +++ b/test/adapter/json_api/type_test.rb @@ -48,7 +48,7 @@ module ActiveModelSerializers end class ResourceIdentifierTest < ActiveSupport::TestCase class WithDefinedTypeSerializer < ActiveModel::Serializer - type 'with_defined_type' + type 'with_defined_types' end class WithDefinedIdSerializer < ActiveModel::Serializer @@ -71,8 +71,18 @@ module ActiveModelSerializers end def test_defined_type - actual = actual_resource_identifier_object(WithDefinedTypeSerializer) - expected = { id: expected_model_id, type: 'with-defined-type' } + actual = with_jsonapi_inflection :plural do + 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 end