Class: InfinumJsonApiSetup::RSpec::Matchers::JsonBodyMatcher
- Inherits:
-
Object
- Object
- InfinumJsonApiSetup::RSpec::Matchers::JsonBodyMatcher
- Defined in:
- lib/infinum_json_api_setup/rspec/matchers/json_body_matcher.rb
Direct Known Subclasses
HaveEmptyData, HaveErrorPointer, HaveResourceCountOf, IncludeAllResourceIds, IncludeErrorDetail, IncludeRelatedResource
Instance Method Summary collapse
- #failure_message ⇒ String
-
#initialize(parser) ⇒ JsonBodyMatcher
constructor
A new instance of JsonBodyMatcher.
- #matches?(response) ⇒ Boolean
Constructor Details
#initialize(parser) ⇒ JsonBodyMatcher
Returns a new instance of JsonBodyMatcher.
5 6 7 |
# File 'lib/infinum_json_api_setup/rspec/matchers/json_body_matcher.rb', line 5 def initialize(parser) @parser = parser end |
Instance Method Details
#failure_message ⇒ String
25 26 27 |
# File 'lib/infinum_json_api_setup/rspec/matchers/json_body_matcher.rb', line 25 def @error_message || end |
#matches?(response) ⇒ Boolean
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/infinum_json_api_setup/rspec/matchers/json_body_matcher.rb', line 11 def matches?(response) @response = response success, result = parser.process(response) if success process_parsing_result(result) body_matches? else @error_message = result false end end |