Sha256: e4d9915dc857fbcbdbe788bb7df7d21ce4fc8cc85a9f39fe3bd7f2f2be6e230a

Contents?: true

Size: 820 Bytes

Versions: 49

Compression:

Stored size: 820 Bytes

Contents

require File.expand_path('../../../../../spec_helper', __FILE__)
require 'net/http'
require File.expand_path('../fixtures/classes', __FILE__)

describe "Net::HTTPHeader#to_hash" do
  before(:each) do
    @headers = NetHTTPHeaderSpecs::Example.new
  end

  it "returns a Hash representing all Header entries (keys in lower case, values as arrays)" do
    @headers.to_hash.should == {}

    @headers["My-Header"] = "test"
    @headers.to_hash.should == { "my-header" => ["test"] }

    @headers.add_field("My-Header", "another test")
    @headers.to_hash.should == { "my-header" => ["test", "another test"] }
  end

  it "does not allow modifying the headers from the returned hash" do
    @headers.to_hash["my-header"] = ["test"]
    @headers.to_hash.should == {}
    @headers.key?("my-header").should be_false
  end
end

Version data entries

49 entries across 49 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-7.5.1 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-7.4.1 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-7.1.17 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-6.2.0 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-6.0.11 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-5.5.18 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-5.5.17 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-5.5.15 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-5.5.2 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-5.5.0 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-3.5.1.12 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-3.3.5 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb
rhodes-3.4.2 spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb