Sha256: 3379ef10c580f49769b44df42b6db4aa57747f3f562c69e89619904ea7843fa8

Contents?: true

Size: 783 Bytes

Versions: 21

Compression:

Stored size: 783 Bytes

Contents

require "spec_helper"
require "httpi"

describe HTTPI::CookieStore do

  let(:user_cookie)  { some_cookie(:user, "chucknorris") }
  let(:token_cookie) { some_cookie(:token, "strawberry") }

  it "stores a set of cookies" do
    cookie_store = HTTPI::CookieStore.new
    cookie_store.add(user_cookie, token_cookie)
    expect(cookie_store.fetch).to include("user=chucknorris", "token=strawberry")

    # add a new token cookie with a different value
    token_cookie = some_cookie(:token, "choc-choc-chip")
    cookie_store.add(token_cookie)

    expect(cookie_store.fetch).to include("token=choc-choc-chip")
    expect(cookie_store.fetch).not_to include("token=strawberry")
  end

  def some_cookie(name, value)
    HTTPI::Cookie.new("#{name}=#{value}; Path=/; HttpOnly")
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
httpi-4.0.3 spec/httpi/cookie_store_spec.rb
httpi-4.0.2 spec/httpi/cookie_store_spec.rb
httpi-4.0.1 spec/httpi/cookie_store_spec.rb
httpi-3.0.2 spec/httpi/cookie_store_spec.rb
httpi-3.0.1 spec/httpi/cookie_store_spec.rb
httpi-3.0.0 spec/httpi/cookie_store_spec.rb
httpi-2.5.0 spec/httpi/cookie_store_spec.rb
httpi-2.4.5 spec/httpi/cookie_store_spec.rb
httpi-2.4.4 spec/httpi/cookie_store_spec.rb
httpi-2.4.3 spec/httpi/cookie_store_spec.rb
httpi-2.4.2 spec/httpi/cookie_store_spec.rb
httpi-2.4.1 spec/httpi/cookie_store_spec.rb
httpi-2.4.0 spec/httpi/cookie_store_spec.rb
httpi-2.3.0 spec/httpi/cookie_store_spec.rb
httpi-2.2.7 spec/httpi/cookie_store_spec.rb
httpi-2.2.6 spec/httpi/cookie_store_spec.rb
httpi-2.2.5 spec/httpi/cookie_store_spec.rb
httpi-2.2.4 spec/httpi/cookie_store_spec.rb
httpi-2.2.3 spec/httpi/cookie_store_spec.rb
httpi-2.2.1 spec/httpi/cookie_store_spec.rb