summaryrefslogtreecommitdiff
path: root/spec/ruby/library/net/http/httpheader/type_params_spec.rb
blob: e77be7ea85f332814eefc45adea827bab4764ab6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require_relative '../../../../spec_helper'
require 'net/http'
require_relative 'fixtures/classes'

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

  it "returns additional 'Content-Type' information as a Hash" do
    @headers["Content-Type"] = "text/html;charset=utf-8"
    @headers.type_params.should == {"charset" => "utf-8"}

    @headers["Content-Type"] = "text/html; charset=utf-8; rubyspec=rocks"
    @headers.type_params.should == {"charset" => "utf-8", "rubyspec" => "rocks"}
  end

  it "returns an empty Hash when no additional 'Content-Type' information is set" do
    @headers.type_params.should == {}

    @headers["Content-Type"] = "text/html"
    @headers.type_params.should == {}
  end
end