Sha256: 5ce41737292e95576cd6f60cc145f7b3bcd9391357b655c28aa6577b1cd94b67

Contents?: true

Size: 616 Bytes

Versions: 2

Compression:

Stored size: 616 Bytes

Contents

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

    def with(params)
      @request_profile.body = params[:body]
      @request_profile.headers = Utility.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.1 lib/webmock/request_stub.rb
webmock-0.7.0 lib/webmock/request_stub.rb