Sha256: e91379940b4552ad4573eac6589520c3ec91ca4a4b3cbfa5efe8823278e00fd8

Contents?: true

Size: 712 Bytes

Versions: 2

Compression:

Stored size: 712 Bytes

Contents

module FakeMechanize
  class ErrorRequest < Request
    attr_reader :params_not_equal
    
    def initialize(args = {})
      super
      @params_not_equal = args[:params_not_equal]
    end
    
    def match(alt)
      count = 0

      # Simple calculations
      count += 1 if method  == alt.method
      count += 1 if uri     == alt.uri

      # More complicated: evaluates if params are equals or if they are different on purpose
      if !request_headers.empty? and request_headers == alt.request_headers
        count += 1
      elsif method == alt.method and uri == alt.uri and request_headers != params_not_equal
        count += 1
      end

      count
    end
  end # ErrorRequest
end # FakeMechanize

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fake_mechanize-0.0.0 lib/fake_mechanize/error_request.rb
fake_mechanize-0.0.1 lib/fake_mechanize/error_request.rb