Skip to content

Verify JSON validation errors #4

Open
@Startouf

Description

@Startouf

Following the https://jsonapi-suite.github.io/jsonapi_errorable/ documentation, it would be great to be able to verify automatically the presence of errors in the JSON response

Suppose I have an error response like this

{
    "errors" => [
        [0] {
              "code" => "unprocessable_entity",
            "status" => "422",
             "title" => "Validation Error",
            "detail" => "Billing_vat_number is not a valid european VAT number",
            "source" => {
                "pointer" => "/data/attributes/billing_vat_number"
            },
              "meta" => {
                "attribute" => "billing_vat_number",
                  "message" => "this is not a valid european VAT number"
            }
        }
    ]
}

a nice Jsonapi spec matcher helper should let us write something like

expect(response).to have_jsonapi_errors([
  'billing_vat_number, :not_eu_vat'
])

What do you think ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions