Sha256: d9fadbc1edfff7cc1df77a81d0d8cbcad7e8cb680bac620b68d897bd70b9170e

Contents?: true

Size: 730 Bytes

Versions: 9

Compression:

Stored size: 730 Bytes

Contents

require File.expand_path("helper", File.dirname(__FILE__))

test "set cookie" do
  Cuba.define do
    on default do
      res.set_cookie("foo", "bar")
      res.set_cookie("bar", "baz")
      res.write "Hello"
    end
  end

  env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/" }

   _, headers, body = Cuba.call(env)

   assert_equal "foo=bar\nbar=baz", headers["Set-Cookie"]
end

test "delete cookie" do
  Cuba.define do
    on default do
      res.set_cookie("foo", "bar")
      res.delete_cookie("foo")
      res.write "Hello"
    end
  end

  env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/" }

   _, headers, body = Cuba.call(env)

   assert_equal "foo=; expires=Thu, 01-Jan-1970 00:00:00 GMT",
     headers["Set-Cookie"]
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cuba-3.1.0 test/cookie.rb
cuba-3.1.0.rc2 test/cookie.rb
cuba-3.1.0.rc1 test/cookie.rb
cuba-3.0.1.rc2 test/cookie.rb
cuba-3.0.1.rc1 test/cookie.rb
cuba-3.0.0 test/cookie.rb
cuba-3.0.0.rc5 test/cookie.rb
cuba-3.0.0.rc4 test/cookie.rb
cuba-3.0.0.rc3 test/cookie.rb