aboutsummaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/zero/request/parameter/cookie_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/unit/zero/request/parameter/cookie_spec.rb b/spec/unit/zero/request/parameter/cookie_spec.rb
new file mode 100644
index 0000000..f1f5d9d
--- /dev/null
+++ b/spec/unit/zero/request/parameter/cookie_spec.rb
@@ -0,0 +1,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