class Pacto::UriPattern

Public Class Methods

build_relaxed_uri_pattern(request) click to toggle source
# File lib/pacto/stubs/uri_pattern.rb, line 16
def build_relaxed_uri_pattern(request)
  path_pattern = request.path.gsub(/\/:\w+/, '/[^\/\?#]+')
  host_pattern = Regexp.quote(request.host)
  /#{host_pattern}#{path_pattern}/
end
build_strict_uri_pattern(request) click to toggle source
# File lib/pacto/stubs/uri_pattern.rb, line 12
def build_strict_uri_pattern(request)
  "#{request.host}#{request.path}"
end
for(request) click to toggle source
# File lib/pacto/stubs/uri_pattern.rb, line 4
def for(request)
  if Pacto.configuration.strict_matchers
    build_strict_uri_pattern(request)
  else
    build_relaxed_uri_pattern(request)
  end
end