mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Serializers now inherit attributes and associations.
This commit is contained in:
@@ -24,6 +24,18 @@ module ActiveModel
|
||||
'profile' => { name: 'Name 1', description: 'Description 1' }
|
||||
}, @profile_serializer.as_json)
|
||||
end
|
||||
|
||||
def test_attributes_inheritance
|
||||
inherited_serializer_klass = Class.new(ProfileSerializer) do
|
||||
attributes :comments
|
||||
end
|
||||
another_inherited_serializer_klass = Class.new(ProfileSerializer)
|
||||
|
||||
assert_equal([:name, :description, :comments],
|
||||
inherited_serializer_klass._attributes)
|
||||
assert_equal([:name, :description],
|
||||
another_inherited_serializer_klass._attributes)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user