class JsonapiSpec::Matchers::HaveJsonapiError

Public Instance Methods

failure_message() click to toggle source
# File lib/jsonapi_spec/matchers/have_jsonapi_error.rb, line 14
def failure_message
  "Not a valid jsonapi error #{@validate_error_message}"
end
failure_message_when_negated() click to toggle source
# File lib/jsonapi_spec/matchers/have_jsonapi_error.rb, line 18
def failure_message_when_negated
  "Valid jsonapi error"
end
matches?(json) click to toggle source
# File lib/jsonapi_spec/matchers/have_jsonapi_error.rb, line 6
def matches?(json)
  document = parse_jsonapi(json)
  document.key?('errors')
rescue JSONAPI::Parser::InvalidDocument => ex
  @validate_error_message = ex.message
  false
end