summaryrefslogtreecommitdiff
path: root/spec/ruby/library/cgi
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-28 15:15:48 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-28 15:15:48 +0000
commit8c5b60eb22d6d661e87992a65d54e3a5bc0aeed4 (patch)
tree7905b284cb5b3d62c17ad8a939e339621a498a2c /spec/ruby/library/cgi
parent6530b14cee76e2512424d225e64d3c61dd1f6511 (diff)
Update to ruby/spec@a6b8805
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/library/cgi')
-rw-r--r--spec/ruby/library/cgi/cookie/parse_spec.rb21
-rw-r--r--spec/ruby/library/cgi/shared/http_header.rb6
2 files changed, 24 insertions, 3 deletions
diff --git a/spec/ruby/library/cgi/cookie/parse_spec.rb b/spec/ruby/library/cgi/cookie/parse_spec.rb
index dc8498dcb43..6f615c0d238 100644
--- a/spec/ruby/library/cgi/cookie/parse_spec.rb
+++ b/spec/ruby/library/cgi/cookie/parse_spec.rb
@@ -10,6 +10,27 @@ describe "CGI::Cookie.parse" do
CGI::Cookie.parse("first cookie=one&two;second cookie=three&four").should == expected
end
+ ruby_version_is ""..."2.4" do
+ it "uses , for cookie separators" do
+ expected = {
+ "first cookie" => ["one", "two"],
+ "second cookie" => ["three", "four"],
+ "third_cookie" => ["five", "six"]
+ }
+ CGI::Cookie.parse("first cookie=one&two;second cookie=three&four,third_cookie=five&six").should == expected
+ end
+ end
+
+ ruby_version_is "2.4" do
+ it "does not use , for cookie separators" do
+ expected = {
+ "first cookie" => ["one", "two"],
+ "second cookie" => ["three", "four,third_cookie=five", "six"]
+ }
+ CGI::Cookie.parse("first cookie=one&two;second cookie=three&four,third_cookie=five&six").should == expected
+ end
+ end
+
it "unescapes the Cookie values" do
cookie = "test-cookie=+%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E"
expected = { "test-cookie" => [ " !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ] }
diff --git a/spec/ruby/library/cgi/shared/http_header.rb b/spec/ruby/library/cgi/shared/http_header.rb
index ed65b20abd6..b6d81d2e0e5 100644
--- a/spec/ruby/library/cgi/shared/http_header.rb
+++ b/spec/ruby/library/cgi/shared/http_header.rb
@@ -13,7 +13,7 @@ describe :cgi_http_header, shared: true do
end
- it "returns a HTTP header specifiying the Content-Type as text/html" do
+ it "returns a HTTP header specifying the Content-Type as text/html" do
@cgi.send(@method).should == "Content-Type: text/html\r\n\r\n"
end
@@ -34,7 +34,7 @@ describe :cgi_http_header, shared: true do
end
- it "returns a HTTP header specifiying the Content-Type as the passed String's content" do
+ it "returns a HTTP header specifying the Content-Type as the passed String's content" do
@cgi.send(@method, "text/plain").should == "Content-Type: text/plain\r\n\r\n"
end
@@ -105,7 +105,7 @@ describe :cgi_http_header, shared: true do
@cgi.send(@method, {}).should == "Content-Type: text/html\r\nSet-Cookie: multiple\r\nSet-Cookie: cookies\r\n\r\n"
end
- it "returns a HTTP header specifiying the Content-Type as text/html when passed an empty Hash" do
+ it "returns a HTTP header specifying the Content-Type as text/html when passed an empty Hash" do
@cgi.send(@method, {}).should == "Content-Type: text/html\r\n\r\n"
end
end