Sha256: e836a7f02bfabcf67783701356b0899ebbdb391c6417ba70e1bbc0ce6f07ac8d

Contents?: true

Size: 622 Bytes

Versions: 2

Compression:

Stored size: 622 Bytes

Contents

module WebMock
  class RequestStub
    attr_accessor :request_profile, :response
    
    def initialize(method, uri)
      @request_profile = RequestProfile.new(method, uri)
      @response = WebMock::Response.new
      self
    end

    def with(params)
      @request_profile.body = params[:body]
      @request_profile.headers = Util::Headers.normalize_headers(params[:headers])
      self
    end

    def to_return(response_hash)
      @response = WebMock::Response.new(response_hash)
    end
    
    def to_raise(exception)
      @response = WebMock::Response.new({:exception => exception})
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webmock-0.7.3 lib/webmock/request_stub.rb
webmock-0.7.2 lib/webmock/request_stub.rb