summaryrefslogtreecommitdiff
path: root/spec/ruby/library/net-http/httpheader/shared/set_content_type.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/net-http/httpheader/shared/set_content_type.rb')
-rw-r--r--spec/ruby/library/net-http/httpheader/shared/set_content_type.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/ruby/library/net-http/httpheader/shared/set_content_type.rb b/spec/ruby/library/net-http/httpheader/shared/set_content_type.rb
new file mode 100644
index 0000000000..b7359bdca6
--- /dev/null
+++ b/spec/ruby/library/net-http/httpheader/shared/set_content_type.rb
@@ -0,0 +1,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