Sha256: ad217cacf6befc8f09e3be055463dce58de789fb87961640f74cfb5dbd013949

Contents?: true

Size: 812 Bytes

Versions: 3

Compression:

Stored size: 812 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'

module Anemone
  describe CookieStore do

    it "should start out empty if no cookies are specified" do
      CookieStore.new.empty?.should be true
    end

    it "should accept a Hash of cookies in the constructor" do
      CookieStore.new({'test' => 'cookie'})['test'].value.should == 'cookie'
    end

    it "should be able to merge an HTTP cookie string" do
      cs = CookieStore.new({'a' => 'a', 'b' => 'b'})
      cs.merge! "a=A; path=/, c=C; path=/"
      cs['a'].value.should == 'A'
      cs['b'].value.should == 'b'
      cs['c'].value.should == 'C'
    end

    it "should have a to_s method to turn the cookies into a string for the HTTP Cookie header" do
      CookieStore.new({'a' => 'a', 'b' => 'b'}).to_s.should == 'a=a;b=b'
    end

  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
anemone-0.5.0 spec/cookie_store_spec.rb
spk-anemone-0.4.0 spec/cookie_store_spec.rb
anemone-0.4.0 spec/cookie_store_spec.rb