Sha256: 5a580a68f34c5a40a9b6c3a3c32ff0b251d01da4d42d00cec5cdb45fc1b8e9f5

Contents?: true

Size: 674 Bytes

Versions: 1

Compression:

Stored size: 674 Bytes

Contents

module FakeMechanize
  class Responder
    def initialize(responses, errors)
      @responses, @errors = responses, errors
    end
    
    def error(args)
      if args[:method]
        @errors << ErrorRequest.new(args)
      else
        [:head, :get, :post, :put, :delete].each do |method|
          @errors << ErrorRequest.new({:method => method}.merge(args))
        end
      end
    end
    
    [:head, :get, :post, :put, :delete].each do |method|
      module_eval <<-EOE, __FILE__, __LINE__
        def #{method}(args = {})
          @responses << Request.new({:method => :#{method}}.merge(args))
        end
      EOE
    end
  end # Responder
end # FakeMechanize

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fake_mechanize-0.0.0 lib/fake_mechanize/responder.rb