The last expectation fails. Whatever is put in the cookies hash disappears into a void. This commit fixes that.
req = Rack::Request.new(Rack::MockRequest.env_for(""))
req.cookies['foo'] = 'bar'
req.cookies.should.equal 'foo' => 'bar'
I'm not sure whether writing to the cookie hash is something we should support, since it does not set a cookie.
Indeed, it's not about setting a cookie for the response. It's about having the ability to inject and/or delete a cookie before it's processed further down the stack.
If you don't feel that should be supported, then why is there code in the +cookies+ method that takes into account that @env["HTTP_COOKIE"] might change?
Writing to the cookies hash currently works fine when there's an initial set of cookies, it just doesn't work when the initial set of cookies is empty.
Oh, yes, totally missed that use case.
I will apply this if you wouldn't mind updating to merge cleanly with master.
Thank you for your submission
Hi raggi, done, see lawrencepit@cccacb1
Request should return cookies, also when initially not set.
Apologies, it's lawrencepit@02209e2