aboutsummaryrefslogtreecommitdiff
path: root/spec/unit/zero/request/parameter/cookie_spec.rb
blob: f1f5d9dd088c897cecc7034464b6e0a14d923100 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'spec_helper'

describe Zero::Request::Parameter, '#cookie' do
  subject { Zero::Request::Parameter.new(env) }
  let(:env) { EnvGenerator.get('/foo', {'HTTP_COOKIE' => cookie}) }

  context 'without parameters' do
    let(:env) { EnvGenerator.get('/foo') }
    its(:cookie) { should == {} }
  end

  context 'with a single key value pair' do
    let(:cookie) { 'foo=bar' }
    its(:cookie) { should == {'foo' => 'bar'} }
  end

  context 'with multiple key value pairs' do
    let(:cookie) { 'foo=bar; baz=foobar' }
    its(:cookie) { should == {'foo' => 'bar', 'baz' => 'foobar'} }
  end
end