class Fitting::Matchers::Response
Public Instance Methods
===(other)
click to toggle source
# File lib/fitting/matchers/response_matcher.rb, line 17 def ===(other) matches?(other) end
failure_message()
click to toggle source
# File lib/fitting/matchers/response_matcher.rb, line 21 def failure_message 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)
click to toggle source
# 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
Private Instance Methods
one_match(response, config)
click to toggle source
# File lib/fitting/matchers/response_matcher.rb, line 37 def one_match(response, config) response = Fitting::Response.new(response, config.tomogram) if response.within_prefix?(config.prefix) @response = response return true if @response.ignored?(config.ignore_list) return @response.fully_validates.valid? else true end end