1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2017-10-28 15:15:48 +00:00
parent 6530b14cee
commit 8c5b60eb22
218 changed files with 4069 additions and 328 deletions

View file

@ -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{|}~" ] }

View file

@ -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