Sha256: 5a85182f3a28b2c5819a66b7b27b0bcf360bdb9b651f601870b8996c2c16e628

Contents?: true

Size: 666 Bytes

Versions: 3

Compression:

Stored size: 666 Bytes

Contents

require 'net/http'
require "stringio"

ruby_version_is ''...'1.9.3' do
  describe "Net::HTTPResponse#to_ary" do
    before(:each) do
      @res = Net::HTTPUnknownResponse.new("1.0", "???", "test response")

      socket = Net::BufferedIO.new(StringIO.new("test body"))
      @res.reading_body(socket, true) {}
    end

    it "returns an Array containing a duplicate of self and self's body" do
      ary = @res.to_ary
      ary.size.should == 2

      ary[0].inspect.should == @res.inspect
      ary[1].should == "test body"
    end

    it "removes #to_ary from the duplicate of self" do
      @res.to_ary[0].respond_to?(:to_ary).should be_false
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubysl-net-http-1.0.1 spec/httpresponse/to_ary_spec.rb
rubysl-net-http-2.0.4 spec/httpresponse/to_ary_spec.rb
rubysl-net-http-1.0.0 spec/httpresponse/to_ary_spec.rb