diff options
Diffstat (limited to 'spec/ruby/library/cgi')
-rw-r--r-- | spec/ruby/library/cgi/cookie/parse_spec.rb | 21 | ||||
-rw-r--r-- | spec/ruby/library/cgi/shared/http_header.rb | 6 |
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 dc8498dcb4..6f615c0d23 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 ed65b20abd..b6d81d2e0e 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 |