Skip to content
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

Fix for issue #8 #14

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

happycollision
Copy link
Contributor

This PR is just to let you know I am working on this today. You may not want to version bump from the last merge until this one is done... assuming I get it right!

Fixes jsonapi-suite#8

This produces a failure when the json id doesn't match the record id or when there is no jsonapi_type present.
@happycollision
Copy link
Contributor Author

This would produce a failure in tests that looks like this:

Failures:

  1) JsonapiSpecHelpers#assert_payload when payload contains a "relationship-only" item still properly throws when no item is present
     Got 2 failures from failure aggregation block "payload contains an id and type".
     # ./lib/jsonapi_spec_helpers.rb:57:in `assert_payload'
     # ./spec/assert_payload_spec.rb:278:in `block (4 levels) in <top (required)>'

     1.1) Failure/Error: expect(json['id']).to eq(record.id.to_s)

            expected: "1"
                 got: nil

            (compared using ==)
          # ./lib/jsonapi_spec_helpers.rb:59:in `block in assert_payload'

     1.2) Failure/Error: expect(json['jsonapi_type']).to_not be_nil

            expected: not nil
                 got: nil
          # ./lib/jsonapi_spec_helpers.rb:62:in `block in assert_payload'

@happycollision
Copy link
Contributor Author

I am not 100% sure of the ramifications of ids not being present (when you are creating a record) but I think that wouldn't be a problem since you wouldn't be testing your input for a create action.

@happycollision
Copy link
Contributor Author

If you want to merge this without the first commit (since you just merged my last PR), I am happy to rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant