I'm trying to set a cookie in my integration tests, like so:
cookies.signed[:test] = 1
This fails with:
NoMethodError: undefined method 'signed' for #<Rack::Test::CookieJar>
As far as I can tell, this is because the only kind of cookiejar that supports 'signed' is the ActionDispatch::Cookies::CookieJar kind.
I've tried the workaround outlined here, but then I get:
NoMethodError: undefined method 'env' for nil:NilClass
Some diving into the rails source showed me that this is due to the fact that I'm passing in a nil 'request' object.
It turns out that request is nil no matter how I try to get it - @request is nil, self.request is nil, open_session.request is nil - there's no way to get a non-nil 'request' object.
If I attempt to create my own request object, I get the error mentioned by this person, but none of the solutions posted there work for me.
As you can probably guess, I've been bashing my head against the wall all morning trying to find out what I've missed. Is there a way to set this signed cookie?