Class: JsonapiSpec::Matchers::HaveJsonapiError
- Inherits:
-
Object
- Object
- JsonapiSpec::Matchers::HaveJsonapiError
- Includes:
- Helpers
- Defined in:
- lib/jsonapi_spec/matchers/have_jsonapi_error.rb
Instance Method Summary collapse
Methods included from Helpers
Instance Method Details
#failure_message ⇒ Object
15 16 17 |
# File 'lib/jsonapi_spec/matchers/have_jsonapi_error.rb', line 15 def "Not a valid jsonapi error #{@validate_error_message}" end |
#failure_message_when_negated ⇒ Object
19 20 21 |
# File 'lib/jsonapi_spec/matchers/have_jsonapi_error.rb', line 19 def "Valid jsonapi error" end |
#matches?(json) ⇒ Boolean
6 7 8 9 10 11 12 13 |
# File 'lib/jsonapi_spec/matchers/have_jsonapi_error.rb', line 6 def matches?(json) document = parse_jsonapi(json) return false if document.errors.nil? true rescue JSON::API::InvalidDocument => ex @validate_error_message = ex. false end |