Note invalid JSON:API response expected in tests

This commit is contained in:
Benjamin Fleischer 2017-10-29 22:59:21 -05:00
parent 4076a480b7
commit adf5ae27dd
3 changed files with 4 additions and 2 deletions

View File

@ -62,7 +62,7 @@ module ActiveModel
# #
# Should be reflection_options[:virtual_value] or adapter needs to figure out what to do # Should be reflection_options[:virtual_value] or adapter needs to figure out what to do
# with an object that is non-nil and has no defined serializer. # with an object that is non-nil and has no defined serializer.
cached_result[:virtual_value] = object.try(:as_json) || object cached_result[:virtual_value] = object
else else
cached_result[:serializer] = serializer cached_result[:serializer] = serializer
end end

View File

@ -145,7 +145,7 @@ module ActiveModelSerializers
id: '1', id: '1',
type: 'posts', type: 'posts',
relationships: { relationships: {
tags: { data: [@tag.as_json] } tags: { data: [@tag.as_json] } # invalid jsonapi
} }
} }
}, adapter.serializable_hash) }, adapter.serializable_hash)

View File

@ -11,6 +11,7 @@ module ActiveModel
class CustomCommentLoader class CustomCommentLoader
def all def all
# array of hash... shouldn't allow this to be passed through
[{ foo: 'bar' }] [{ foo: 'bar' }]
end end
end end
@ -175,6 +176,7 @@ module ActiveModel
assert_relationship(:locations, expected) assert_relationship(:locations, expected)
end end
# invalid jsonapi...
def test_block_relationship def test_block_relationship
expected = { expected = {
data: [ data: [