Sha256: 5840e2421764fabd9bf9901d523db1fd3c6aa4de33397893091d4e45a2917592

Contents?: true

Size: 1.01 KB

Versions: 20

Compression:

Stored size: 1.01 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", "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"
    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

20 entries across 20 versions & 1 rubygems

Version Path
dragonfly-1.2.0 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.1.5 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.1.4 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.1.3 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.1.2 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.1.1 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.1.0 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.0.12 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.0.11 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.0.10 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.0.9 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.0.8 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.0.7 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.0.6 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.0.5 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.0.4 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.0.3 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.0.2 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.0.1 spec/dragonfly/cookie_monster_spec.rb
dragonfly-1.0 spec/dragonfly/cookie_monster_spec.rb