Sha256: f8ae534bbd61c53d1e51a0c518da2f5cc7270a9cff48137d389ec48ab51c6b68

Contents?: true

Size: 801 Bytes

Versions: 3

Compression:

Stored size: 801 Bytes

Contents

# -*- encoding : utf-8 -*-
module Pacto
  class RequestPattern < WebMock::RequestPattern
    attr_accessor :uri_template

    def self.for(base_request)
      new(base_request.http_method, UriPattern.for(base_request))
    end

    def initialize(http_method, uri_template)
      @uri_template = uri_template
      super
    end

    def to_s
      string = Pacto::UI.colorize_method(@method_pattern.to_s)
      string << " #{@uri_pattern}"
      # WebMock includes this info, but I don't think we should. Pacto should match on URIs only and then validate the rest...
      # string << " with body #{@body_pattern.to_s}" if @body_pattern
      # string << " with headers #{@headers_pattern.to_s}" if @headers_pattern
      # string << " with given block" if @with_block
      string
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pacto-0.4.0.rc3 lib/pacto/request_pattern.rb
pacto-0.4.0.rc2 lib/pacto/request_pattern.rb
pacto-0.4.0.rc1 lib/pacto/request_pattern.rb