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

Add RSpec matchers for testing json_api error responses #28

Open
swilgosz opened this issue Sep 25, 2020 · 0 comments
Open

Add RSpec matchers for testing json_api error responses #28

swilgosz opened this issue Sep 25, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@swilgosz
Copy link
Member

There is a lot of tedious work involved when there is a need to test JSON:API endpoints. All endpoints can send successful and unsuccessful responses and in terms of possible errors a lot of repetition is involved.

Suggestion:

Add an RSpec matcher to easily check the error responses, i. e:

expect(json).to be_json_api_error(:not_found)
expect(json).to be_json_api_validation_error(validation_errors)

We could add some arguments to it to allow for customization of the expected messages.

@swilgosz swilgosz added the enhancement New feature or request label Sep 25, 2020
@swilgosz swilgosz changed the title Add rspec matchers for testing json_api error responses Add RSpec matchers for testing json_api error responses Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant