Sha256: a5a839d85b9186ac9c0b081960bd4afb20313ae63c1dfb501248eacdd61174e6

Contents?: true

Size: 753 Bytes

Versions: 3

Compression:

Stored size: 753 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", "bar=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=bar", "foo=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT"],
    headers["set-cookie"]
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cuba-4.0.3 test/cookie.rb
cuba-4.0.1 test/cookie.rb
cuba-4.0.0 test/cookie.rb