Sha256: c472087d45706870e1a6681c1f71d11a8c2ed1096b07945e7f06766766304b3b
Contents?: true
Size: 846 Bytes
Versions: 65
Compression:
Stored size: 846 Bytes
Contents
module WebMock class StubRequestSnippet def initialize(request_stub) @request_stub = request_stub end def to_s(with_response = true) request_pattern = @request_stub.request_pattern string = "stub_request(:#{request_pattern.method_pattern.to_s}," string << " \"#{request_pattern.uri_pattern.to_s}\")" with = "" if (request_pattern.body_pattern) with << ":body => #{request_pattern.body_pattern.to_s}" end if (request_pattern.headers_pattern) with << ",\n " unless with.empty? with << ":headers => #{request_pattern.headers_pattern.to_s}" end string << ".\n with(#{with})" unless with.empty? if with_response string << ".\n to_return(:status => 200, :body => \"\", :headers => {})" end string end end end
Version data entries
65 entries across 63 versions & 6 rubygems