Sha256: 59d16599e92c8a376fe3b68fdd1f0a904d84de218312ade5d377a91580206cc1

Contents?: true

Size: 864 Bytes

Versions: 5

Compression:

Stored size: 864 Bytes

Contents

module WebMock
  class StubRequestSnippet
    def initialize(request_signature)
      @request_signature = request_signature
    end

    def to_s
      string = "stub_request(:#{@request_signature.method},"
      string << " \"#{WebMock::Util::URI.strip_default_port_from_uri_string(@request_signature.uri.to_s)}\")"

      with = ""

      if (@request_signature.body.to_s != '')
        with << ":body => #{@request_signature.body.inspect}"
      end

      if (@request_signature.headers && !@request_signature.headers.empty?)
        with << ", \n       " unless with.empty?

        with << ":headers => #{WebMock::Util::Headers.sorted_headers_string(@request_signature.headers)}"
      end
      string << ".\n  with(#{with})" unless with.empty?
      string << ".\n  to_return(:status => 200, :body => \"\", :headers => {})"
      string
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
vanity-1.7.1 vendor/ruby/1.9.1/gems/webmock-1.6.4/lib/webmock/stub_request_snippet.rb
webmock-1.6.4 lib/webmock/stub_request_snippet.rb
webmock-1.6.2 lib/webmock/stub_request_snippet.rb
webmock-1.6.1 lib/webmock/stub_request_snippet.rb
webmock-1.6.0 lib/webmock/stub_request_snippet.rb