Sha256: d2000768a14a901a8ad72de12dc6d2e362b03be04814e0176fb9b3b1aa84c5ab

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'
require 'rack'
require 'dragonfly/cookie_monster'

describe Dragonfly::CookieMonster do

  def app(extra_env={})
    Rack::Builder.new do
      use Dragonfly::CookieMonster
      run proc{|env| env.merge!(extra_env); [200, {"Set-Cookie" => "blah=thing", "Something" => "else"}, ["body here"]] }
    end
  end

  it "should not delete the set-cookie header from the response if the response doesn't come from dragonfly" do
    response = Rack::MockRequest.new(app).get('')
    response.status.should == 200
    response.body.should == "body here"
    response.headers["Set-Cookie"].should == "blah=thing"
    response.headers["Something"].should == "else"
  end

  it "should delete the set-cookie header from the response if the response comes from dragonfly" do
    response = Rack::MockRequest.new(app('dragonfly.job' => double)).get('')
    response.status.should == 200
    response.body.should == "body here"
    response.headers["Set-Cookie"].should be_nil
    response.headers["Something"].should == "else"
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dragonfly-1.4.0 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.3.0 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.2.1 spec/dragonfly/cookie_monster_spec.rb