Refactor object serializer class methods spec#134
Merged
shishirmk merged 4 commits intoNetflix:devfrom Mar 27, 2018
Merged
Conversation
added 4 commits
March 22, 2018 09:10
shuheiktgw
commented
Mar 22, 2018
| end | ||
|
|
||
| it 'returns correct relationship hash for a belongs_to relationship with overrides' do | ||
| MovieSerializer.has_many :area, id_method_name: :blah_id, record_type: :awesome_area, serializer: :my_area |
Contributor
Author
There was a problem hiding this comment.
I guess has_many was supposed to be belongs_to from the it statement...
shuheiktgw
commented
Mar 22, 2018
| MovieSerializer.has_many :roles | ||
| relationship = MovieSerializer.relationships_to_serialize[:roles] | ||
| expect(relationship).to be_instance_of(Hash) | ||
| expect(relationship.keys).to all(be_instance_of(Symbol)) |
Contributor
Author
There was a problem hiding this comment.
I added those Hash and Symbol assertions to every test cases.
shuheiktgw
commented
Mar 22, 2018
| relationship = MovieSerializer.relationships_to_serialize[:roles] | ||
| expect(relationship).to be_instance_of(Hash) | ||
| expect(relationship.keys).to all(be_instance_of(Symbol)) | ||
| expect(relationship[:id_method_name]).to end_with '_ids' |
Contributor
Author
There was a problem hiding this comment.
I changed this and one below to assert in more direct way.
Contributor
Author
|
I 'm also thinking about integrating |
andyjeffries
pushed a commit
to andyjeffries/fast_jsonapi
that referenced
this pull request
May 25, 2018
* Add object_serializer_class_methods_examples * Change to require spec/shared/examples in every spec files * Refactor object_serializer_class_methods_spec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I refactored
object_serializer_class_methods_spec.rbwithsubject,letandshared_examplesince some of the examples seem to be not well organized... Also, I added some missing test cases and fixed seemingly wrong examples!