Skip to content

Add RSpec matchers for testing json_api error responses #28

@swilgosz

Description

@swilgosz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions