-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for meta on resource objects. #1
Conversation
@rafael Thanks a lot! I think there should be tests in |
class MetaPostSerializer < ActiveModel::Serializer | ||
attributes :id | ||
meta do | ||
{ stuff: "value" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to make a test using the block syntax (like here) to make use of some of object
's property, like
meta do
{ comments_count: object.comments.count }
end
and an other test that makes use of the direct syntax (no bloc) as follows:
meta { stuff: 'value' }
Detail: use single quotes for strings without interpolation, otherwise Rubocop will complain when we try to merge it.
When those are taken care of, I'll be happy to merge your commit in my branch, and then get the branch merged into master! |
Cool! Thanks for the feedback. Will make this changes and update the PR. |
58d475f
to
d0c5883
Compare
d0c5883
to
e4ea512
Compare
@beauby . I was not 100% I got what you meant with the serializer-level tests. I added some. Do they look good to you ? |
@beauby did you have a chance to review the tests ? Do they look good to merge? |
@rafael Can't really review it right now but it looks good so I'm merging those into my branch and we'll ask people to review it on |
Add tests for meta on resource objects.
Awesome! Thanks guys! |
Add tests for meta on resource objects.
@beauby what do you think about this as starting point? Are there any other tests that you think we should add? Do you think adding a new file is ok or is it a better place for these tests to live?
TODO:
ActiveModel::Serializer.meta
andActiveModel::Serializer#meta
)object
itself (in order to showcase the power of blocks over direct params)