mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Note invalid JSON:API response expected in tests
This commit is contained in:
parent
4076a480b7
commit
adf5ae27dd
@ -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
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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: [
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user