Serializers now inherit attributes and associations.

This commit is contained in:
Stas SUȘCOV
2013-12-11 17:22:07 +02:00
parent 2faa571a9c
commit 0febd8f628
3 changed files with 26 additions and 2 deletions

View File

@@ -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