Spec for linked resource type name demodulization

This commit is contained in:
Robbie Pitts
2015-01-11 16:10:02 -05:00
parent 90023b1af7
commit b626ec8f14
4 changed files with 38 additions and 3 deletions

15
test/fixtures/poro.rb vendored
View File

@@ -47,6 +47,8 @@ Author = Class.new(Model)
Bio = Class.new(Model)
Blog = Class.new(Model)
Role = Class.new(Model)
module Spam; end
Spam::UnrelatedLink = Class.new(Model)
PostSerializer = Class.new(ActiveModel::Serializer) do
attributes :title, :body, :id
@@ -56,6 +58,15 @@ PostSerializer = Class.new(ActiveModel::Serializer) do
url :comments
end
SpammyPostSerializer = Class.new(ActiveModel::Serializer) do
attributes :id
has_many :related
def self.root_name
'posts'
end
end
CommentSerializer = Class.new(ActiveModel::Serializer) do
attributes :id, :body
@@ -123,3 +134,7 @@ PostPreviewSerializer = Class.new(ActiveModel::Serializer) do
has_many :comments, serializer: CommentPreviewSerializer
belongs_to :author, serializer: AuthorPreviewSerializer
end
Spam::UnrelatedLinkSerializer = Class.new(ActiveModel::Serializer) do
attributes :id
end