Class: Fitting::Matchers::Response
- Inherits:
-
Object
- Object
- Fitting::Matchers::Response
- Defined in:
- lib/fitting/matchers/response_matcher.rb
Instance Method Summary collapse
Instance Method Details
#===(other) ⇒ Object
17 18 19 |
# File 'lib/fitting/matchers/response_matcher.rb', line 17 def ===(other) matches?(other) end |
#failure_message ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fitting/matchers/response_matcher.rb', line 21 def unless @response.documented? return "response not documented\n"\ "got: #{@response.real_request_with_status}" end return nil if @response.fully_validates.valid? "response does not conform to json-schema\n"\ "schemas: \n#{@response.expected}\n\n"\ "got: #{@response.got}\n\n"\ "errors: \n#{@response.fully_validates}\n" end |
#matches?(response) ⇒ Boolean
7 8 9 10 11 12 13 14 15 |
# File 'lib/fitting/matchers/response_matcher.rb', line 7 def matches?(response) if Fitting.configuration.is_a?(Array) Fitting.configuration.all? do |config| one_match(response, config) end else one_match(response, Fitting.configuration) end end |