test/spec_request.rb in rack-1.3.2 vs test/spec_request.rb in rack-1.3.3
- old
+ new
@@ -349,9 +349,22 @@
req.cookies.should.equal "foo" => "bar", "quux" => "h&m"
req.env.delete("HTTP_COOKIE")
req.cookies.should.equal({})
end
+ should "always return the same hash object" do
+ req = Rack::Request.new \
+ Rack::MockRequest.env_for("", "HTTP_COOKIE" => "foo=bar;quux=h&m")
+ hash = req.cookies
+ req.env.delete("HTTP_COOKIE")
+ req.cookies.should.equal(hash)
+ end
+
+ should "raise any errors on every request" do
+ req = Rack::Request.new Rack::MockRequest.env_for("", "HTTP_COOKIE" => "foo=%")
+ 2.times { proc { req.cookies }.should.raise(ArgumentError) }
+ end
+
should "parse cookies according to RFC 2109" do
req = Rack::Request.new \
Rack::MockRequest.env_for('', 'HTTP_COOKIE' => 'foo=bar;foo=car')
req.cookies.should.equal 'foo' => 'bar'
end