class Faraday::Adapter::Test::Stub

def headers_match?(request_headers)

def headers_match?(request_headers)
  headers.keys.all? do |key|
    request_headers[key] == headers[key]
  end
end

def initialize(full, headers, body, block)

def initialize(full, headers, body, block)
  path, query = full.respond_to?(:split) ? full.split("?") : full
  params = query ?
    Faraday::Utils.parse_nested_query(query) :
    {}
  super(path, params, headers, body, block)
end

def matches?(request_uri, request_headers, request_body)

def matches?(request_uri, request_headers, request_body)
  request_path, request_query = request_uri.split('?')
  request_params = request_query ?
    Faraday::Utils.parse_nested_query(request_query) :
    {}
  # meta is a hash use as carrier
  # that will be yielded to consumer block
  meta = {}
  return path_match?(request_path, meta) &&
    params_match?(request_params) &&
    (body.to_s.size.zero? || request_body == body) &&
    headers_match?(request_headers), meta
end

def params_match?(request_params)

def params_match?(request_params)
  params.keys.all? do |key|
    request_params[key] == params[key]
  end
end

def path_match?(request_path, meta)

def path_match?(request_path, meta)
  if path.is_a? Regexp
    !!(meta[:match_data] = path.match(request_path))
  else
    path == request_path
  end
end

def to_s

def to_s
  "#{path} #{body}"
end