Sha256: 12edf16da25c830eeb15657a4574da2eb20f003aa352b1cd2cb7bfcf14c63236

Contents?: true

Size: 685 Bytes

Versions: 22

Compression:

Stored size: 685 Bytes

Contents

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

describe "cookies plugin" do 
  it "should set cookies on response" do
    app(:cookies) do |r|
      response.set_cookie("foo", "bar")
      response.set_cookie("bar", "baz")
      "Hello"
    end

    header('Set-Cookie').must_equal "foo=bar\nbar=baz"
    body.must_equal 'Hello'
  end

  it "should delete cookies on response" do
    app(:cookies) do |r|
      response.set_cookie("foo", "bar")
      response.delete_cookie("foo")
      "Hello"
    end

    header('Set-Cookie').must_match(/foo=; (max-age=0; )?expires=Thu, 01[ -]Jan[ -]1970 00:00:00 (-0000|GMT)/)
    body.must_equal 'Hello'
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
roda-2.4.0 spec/plugin/cookies_spec.rb
roda-2.3.0 spec/plugin/cookies_spec.rb