Add tests for has_one polymorphic

This commit is contained in:
Pol Miro
2013-10-24 23:50:00 -08:00
parent 63589f7500
commit bb18fc6225
2 changed files with 208 additions and 0 deletions

12
test/fixtures/poro.rb vendored
View File

@@ -38,6 +38,12 @@ end
class WebLog < Model
end
class Interview < Model
def attachment
@attachment ||= Image.new(url: 'U1')
end
end
class Mail < Model
def attachments
@attachments ||= [Image.new(url: 'U1'),
@@ -87,6 +93,12 @@ class WebLogLowerCamelSerializer < WebLogSerializer
format_keys :lower_camel
end
class InterviewSerializer < ActiveModel::Serializer
attributes :text
has_one :attachment, polymorphic: true
end
class MailSerializer < ActiveModel::Serializer
attributes :body