Sha256: bd11b279cc357ea52dcc755d81887b45071c059e8c78d4687bdf588dfe2b0b42

Contents?: true

Size: 850 Bytes

Versions: 3

Compression:

Stored size: 850 Bytes

Contents

require 'net/http'
require "stringio"

describe "Net::HTTPGenericRequest#body_stream" do
  it "returns self's body stream Object" do
    request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path")
    request.body_stream.should be_nil

    stream = StringIO.new("test")
    request.body_stream = stream
    request.body_stream.should equal(stream)
  end
end

describe "Net::HTTPGenericRequest#body_stream=" do
  before(:each) do
    @request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path")
    @stream = StringIO.new("test")
  end

  it "sets self's body stream to the passed Object" do
    @request.body_stream = @stream
    @request.body_stream.should equal(@stream)
  end

  it "sets self's body to nil" do
    @request.body = "Some Content"
    @request.body_stream = @stream
    @request.body.should be_nil
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubysl-net-http-1.0.1 spec/httpgenericrequest/body_stream_spec.rb
rubysl-net-http-2.0.4 spec/httpgenericrequest/body_stream_spec.rb
rubysl-net-http-1.0.0 spec/httpgenericrequest/body_stream_spec.rb