diff options
author | Ben Toews <mastahyeti@users.noreply.github.com> | 2016-03-15 09:18:44 -0600 |
---|---|---|
committer | Ben Toews <mastahyeti@users.noreply.github.com> | 2016-03-15 12:58:35 -0600 |
commit | 9e6ebdd34f50ad01014394fa82d0dc5e46fa868a (patch) | |
tree | 20b7b4da2c840e8bd63f690b252fe0f4d5b064b8 /test/spec_response.rb | |
parent | 95172a60fe5c2a3850163fc75e0981fe440c064e (diff) | |
download | rack-9e6ebdd34f50ad01014394fa82d0dc5e46fa868a.tar.gz |
first-party cookies are now same-site cookies
remove use of `:first_party` option
pass along provided value
make the syntax more flexible
s/strict/Strict/
Diffstat (limited to 'test/spec_response.rb')
-rw-r--r-- | test/spec_response.rb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/test/spec_response.rb b/test/spec_response.rb index f1028826..70d81590 100644 --- a/test/spec_response.rb +++ b/test/spec_response.rb @@ -115,16 +115,28 @@ describe Rack::Response do response["Set-Cookie"].must_equal "foo=bar" end - it "can set First-Party cookies" do + it "can set SameSite cookies with any truthy value" do response = Rack::Response.new - response.set_cookie "foo", {:value => "bar", :first_party => true} - response["Set-Cookie"].must_equal "foo=bar; First-Party" + response.set_cookie "foo", {:value => "bar", :same_site => Object.new} + response["Set-Cookie"].must_equal "foo=bar; SameSite" + end + + it "can set SameSite cookies with string value" do + response = Rack::Response.new + response.set_cookie "foo", {:value => "bar", :same_site => "Lax"} + response["Set-Cookie"].must_equal "foo=bar; SameSite=Lax" + end + + it "can set SameSite cookies with symbol value" do + response = Rack::Response.new + response.set_cookie "foo", {:value => "bar", :same_site => :Strict} + response["Set-Cookie"].must_equal "foo=bar; SameSite=Strict" end [ nil, false ].each do |non_truthy| - it "omits First-Party attribute given a #{non_truthy.inspect} value" do + it "omits SameSite attribute given a #{non_truthy.inspect} value" do response = Rack::Response.new - response.set_cookie "foo", {:value => "bar", :first_party => non_truthy} + response.set_cookie "foo", {:value => "bar", :same_site => non_truthy} response["Set-Cookie"].must_equal "foo=bar" end end |