mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Fail if collection type cannot be inferred with json adapter (#2210)
This commit is contained in:
@@ -93,12 +93,16 @@ module ActiveModel
|
||||
resource = []
|
||||
resource.define_singleton_method(:name) { nil }
|
||||
serializer = collection_serializer.new(resource)
|
||||
assert_nil serializer.json_key
|
||||
assert_raise ArgumentError do
|
||||
serializer.json_key
|
||||
end
|
||||
end
|
||||
|
||||
def test_json_key_with_resource_without_name_and_no_serializers
|
||||
serializer = collection_serializer.new([])
|
||||
assert_nil serializer.json_key
|
||||
assert_raise ArgumentError do
|
||||
serializer.json_key
|
||||
end
|
||||
end
|
||||
|
||||
def test_json_key_with_empty_resources_with_serializer
|
||||
|
||||
Reference in New Issue
Block a user