Sha256: 2e54d29b3deed657710d1245e7c92574909130f576ceb0703a3edf11dd461ec6

Contents?: true

Size: 673 Bytes

Versions: 3

Compression:

Stored size: 673 Bytes

Contents

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

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

  it "returns the 'main-content-type', as per 'Content-Type' header entry" do
    @headers["Content-Type"] = "text/html"
    @headers.main_type.should == "text"

    @headers["Content-Type"] = "application/pdf"
    @headers.main_type.should == "application"

    @headers["Content-Type"] = "text/html;charset=utf-8"
    @headers.main_type.should == "text"
  end

  it "returns nil if the 'Content-Type' header entry does not exist" do
    @headers.main_type.should be_nil
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubysl-net-http-1.0.1 spec/httpheader/main_type_spec.rb
rubysl-net-http-2.0.4 spec/httpheader/main_type_spec.rb
rubysl-net-http-1.0.0 spec/httpheader/main_type_spec.rb