Fix: resource object identifier with nil id excludes id

This commit is contained in:
Benjamin Fleischer
2017-10-31 14:34:30 -05:00
parent 92dde58f5f
commit 5916014b48
2 changed files with 12 additions and 2 deletions

View File

@@ -128,6 +128,13 @@ module ActiveModelSerializers
assert_equal actual, expected
end
def test_blank_id
@model.id = nil
actual = actual_resource_identifier_object(AuthorSerializer)
expected = { type: expected_model_type }
assert_equal actual, expected
end
def test_id_defined_on_serializer
actual = actual_resource_identifier_object(WithDefinedIdSerializer)
expected = { id: 'special_id', type: expected_model_type }