Sha256: 884280c831599657511228dee41550d016a3fc1032241a2bfbd25dc8bc741bf4

Contents?: true

Size: 743 Bytes

Versions: 12

Compression:

Stored size: 743 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=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000",
     headers["Set-Cookie"]
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cuba-3.9.2 test/cookie.rb
cuba-3.9.1 test/cookie.rb
cuba-3.9.0 test/cookie.rb
cuba-3.8.1 test/cookie.rb
cuba-3.8.0 test/cookie.rb
cuba-3.7.0 test/cookie.rb
cuba-3.6.0 test/cookie.rb
cuba-3.5.0 test/cookie.rb
cuba-3.4.0 test/cookie.rb
cuba-3.3.0 test/cookie.rb
cuba-3.2.0 test/cookie.rb
cuba-3.1.1 test/cookie.rb