class WebMock::URIAddressablePattern

Public Instance Methods

add_query_params(query_params) click to toggle source
Calls superclass method WebMock::URIPattern#add_query_params
# File lib/webmock/request_pattern.rb, line 144
def add_query_params(query_params)
  warn "WebMock warning: ignoring query params in RFC 6570 template and checking them with WebMock"
  super(query_params)
end
matches?(uri) click to toggle source
# File lib/webmock/request_pattern.rb, line 133
def matches?(uri)
  if @query_params.nil?
    # Let Addressable check the whole URI
    WebMock::Util::URI.variations_of_uri_as_strings(uri).any? { |u| @pattern.match(u) }
  else
    # WebMock checks the query, Addressable checks everything else
    WebMock::Util::URI.variations_of_uri_as_strings(uri.omit(:query)).any? { |u| @pattern.match(u) } &&
      @query_params == WebMock::Util::QueryMapper.query_to_values(uri.query)
  end
end
to_s() click to toggle source
# File lib/webmock/request_pattern.rb, line 149
def to_s
  str = @pattern.pattern.inspect
  str += " with variables #{@pattern.variables.inspect}" if @pattern.variables
  str
end