aboutsummaryrefslogtreecommitdiffstats
path: root/spec/rubyspec/library/net/http/httpheader/shared/set_content_type.rb
blob: b7359bdca65ba82fd547bb7e4d05a7d7bc787f38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
describe :net_httpheader_set_content_type, shared: true do
  describe "when passed type, params" do
    before :each do
      @headers = NetHTTPHeaderSpecs::Example.new
    end

    it "sets the 'Content-Type' header entry based on the passed type and params" do
      @headers.send(@method, "text/html")
      @headers["Content-Type"].should == "text/html"

      @headers.send(@method, "text/html", "charset" => "utf-8")
      @headers["Content-Type"].should == "text/html; charset=utf-8"

      @headers.send(@method, "text/html", "charset" => "utf-8", "rubyspec" => "rocks")
      @headers["Content-Type"].split(/; /).sort.should == %w[charset=utf-8 rubyspec=rocks text/html]
    end
  end
end