Sha256: c69b609084b9c59b28a226ba87735f67eef48667efb17a8a1d7261f7a2264108

Contents?: true

Size: 680 Bytes

Versions: 4

Compression:

Stored size: 680 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').should == "foo=bar\nbar=baz"
    body.should == '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').should =~ /foo=; (max-age=0; )?expires=Thu, 01[ -]Jan[ -]1970 00:00:00 (-0000|GMT)/
    body.should == 'Hello'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roda-2.2.0 spec/plugin/cookies_spec.rb
roda-2.1.0 spec/plugin/cookies_spec.rb
roda-2.0.0 spec/plugin/cookies_spec.rb
roda-1.3.0 spec/plugin/cookies_spec.rb