diff options
Diffstat (limited to 'spec/ruby/library/net-http/httpheader/main_type_spec.rb')
-rw-r--r-- | spec/ruby/library/net-http/httpheader/main_type_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/ruby/library/net-http/httpheader/main_type_spec.rb b/spec/ruby/library/net-http/httpheader/main_type_spec.rb new file mode 100644 index 0000000000..4dd551d8f4 --- /dev/null +++ b/spec/ruby/library/net-http/httpheader/main_type_spec.rb @@ -0,0 +1,24 @@ +require_relative '../../../spec_helper' +require 'net/http' +require_relative 'fixtures/classes' + +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 |