diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-11-22 11:29:04 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-11-22 11:32:28 +0900 |
commit | 36f297e62108072b9377d927321928b994f66a93 (patch) | |
tree | 7e1871369cb2e139b796a884285370afa5f09599 /spec/ruby | |
parent | 32d202eb932c8c08f8c1a24a7c266e776d7f2223 (diff) | |
download | ruby-36f297e62108072b9377d927321928b994f66a93.tar.gz |
Use valid tokens as cookie names
Diffstat (limited to 'spec/ruby')
-rw-r--r-- | spec/ruby/library/cgi/cookie/name_spec.rb | 12 | ||||
-rw-r--r-- | spec/ruby/library/cgi/cookie/parse_spec.rb | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/spec/ruby/library/cgi/cookie/name_spec.rb b/spec/ruby/library/cgi/cookie/name_spec.rb index 14226824c8..326a43ade3 100644 --- a/spec/ruby/library/cgi/cookie/name_spec.rb +++ b/spec/ruby/library/cgi/cookie/name_spec.rb @@ -6,18 +6,18 @@ describe "CGI::Cookie#name" do cookie = CGI::Cookie.new("test-cookie") cookie.name.should == "test-cookie" - cookie = CGI::Cookie.new("name" => "another cookie") - cookie.name.should == "another cookie" + cookie = CGI::Cookie.new("name" => "another-cookie") + cookie.name.should == "another-cookie" end end describe "CGI::Cookie#name=" do it "sets self's expiration date" do cookie = CGI::Cookie.new("test-cookie") - cookie.name = "another name" - cookie.name.should == "another name" + cookie.name = "another-name" + cookie.name.should == "another-name" - cookie.name = "and one more" - cookie.name.should == "and one more" + cookie.name = "and-one-more" + cookie.name.should == "and-one-more" end end diff --git a/spec/ruby/library/cgi/cookie/parse_spec.rb b/spec/ruby/library/cgi/cookie/parse_spec.rb index 90d2c3d148..d484c7bad9 100644 --- a/spec/ruby/library/cgi/cookie/parse_spec.rb +++ b/spec/ruby/library/cgi/cookie/parse_spec.rb @@ -6,16 +6,16 @@ describe "CGI::Cookie.parse" do expected = { "test-cookie" => ["one", "two", "three"] } CGI::Cookie.parse("test-cookie=one&two&three").should == expected - expected = { "second cookie" => ["three", "four"], "first cookie" => ["one", "two"] } - CGI::Cookie.parse("first cookie=one&two;second cookie=three&four").should == expected + expected = { "second-cookie" => ["three", "four"], "first-cookie" => ["one", "two"] } + CGI::Cookie.parse("first-cookie=one&two;second-cookie=three&four").should == expected end it "does not use , for cookie separators" do expected = { - "first cookie" => ["one", "two"], - "second cookie" => ["three", "four,third_cookie=five", "six"] + "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 + CGI::Cookie.parse("first-cookie=one&two;second-cookie=three&four,third_cookie=five&six").should == expected end it "unescapes the Cookie values" do |