Skip to content

Add jsonapi rspec helper gem #10

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Apr 18, 2022
Merged

Add jsonapi rspec helper gem #10

merged 2 commits into from
Apr 18, 2022

Conversation

zakariaf
Copy link
Owner

Add jsonapi-rspec which provides some beautiful RSpec matchers for JSON API

Some of the matchers:

Available matchers:

expect(document['data']).to have_id('12')
expect(document['data']).to have_type('users')
expect(document['data']).to have_jsonapi_attributes(:name, :email)
expect(document['data']).to have_jsonapi_attributes(:name, :email, :country).exactly
expect(document['data']).to have_attribute(:name).with_value('Lucas')
expect(document['data']).to have_relationships(:posts, :comments)

Check the gem GitHub page to see the list of all RSpec matchers

@zakariaf zakariaf merged commit 74ad609 into main Apr 18, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant