class ApiSim::Matchers::BaseMatcher
Constants
- ALWAYS_TRUE_MATCHER
- DEFAULT_RACK_RESPONSE
Attributes
request_schema[R]
Public Instance Methods
custom_matcher?()
click to toggle source
# File lib/api_sim/matchers/base_matcher.rb, line 10 def custom_matcher? matcher != ALWAYS_TRUE_MATCHER end
match_on_body?()
click to toggle source
# File lib/api_sim/matchers/base_matcher.rb, line 31 def match_on_body? false end
overridden!()
click to toggle source
# File lib/api_sim/matchers/base_matcher.rb, line 14 def overridden! @overridden = true end
overridden?()
click to toggle source
# File lib/api_sim/matchers/base_matcher.rb, line 18 def overridden? !!@overridden end
readonly?()
click to toggle source
# File lib/api_sim/matchers/base_matcher.rb, line 35 def readonly? false end
record_request(request)
click to toggle source
# File lib/api_sim/matchers/base_matcher.rb, line 39 def record_request(request) request.body.rewind requests.push(RecordedRequest.new(body: request.body.read, request_env: request.env, request_path: request.path, query_string: request.params)) end
requests()
click to toggle source
# File lib/api_sim/matchers/base_matcher.rb, line 27 def requests @requests ||= [] end
reset!()
click to toggle source
# File lib/api_sim/matchers/base_matcher.rb, line 22 def reset! @requests = [] @overridden = false end
response(_)
click to toggle source
# File lib/api_sim/matchers/base_matcher.rb, line 51 def response(_) [response_code, headers, response_body] end
to_s()
click to toggle source
# File lib/api_sim/matchers/base_matcher.rb, line 45 def to_s <<-DOC.gsub(/^\s+/, '') #{http_method} #{route} DOC end
Protected Instance Methods
matches_route_pattern?(request)
click to toggle source
# File lib/api_sim/matchers/base_matcher.rb, line 57 def matches_route_pattern?(request) route.match(request.path) end