mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Follows inheritance with a namespace
Co-authored-by: Rafael Gaspar <rafael.gaspar@me.com> Co-authored-by: Darryl Pogue <darryl@dpogue.ca> Co-authored-by: Artin Boghosian <artinboghosian@gmail.com>
This commit is contained in:
committed by
Darryl Pogue
parent
777fab04ae
commit
beffbb2bd3
@@ -9,6 +9,7 @@ module ActiveModel
|
||||
attributes :title, :author_name
|
||||
associations :publisher, :pages
|
||||
end
|
||||
class Ebook < Book; end
|
||||
class Page < ::Model; attributes :number, :text end
|
||||
class Publisher < ::Model; attributes :name end
|
||||
|
||||
@@ -85,6 +86,11 @@ module ActiveModel
|
||||
}
|
||||
assert_equal expected, result
|
||||
end
|
||||
|
||||
test 'follows inheritance with a namespace' do
|
||||
serializer = ActiveModel::Serializer.serializer_for(Ebook.new, namespace: Api::V3)
|
||||
assert_equal Api::V3::BookSerializer, serializer
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user