Reputation: 8511
How do I set cookies in my request specs?
The solutions on the following page did not work:
Rspec: setting cookies in a helper test
Namely, request.cookies[:whatever] = 'something'
says that request
is a nil
object. I also tried helper.cookies[:whatever] = 'something'
, and that also did not work (helper
in that case was nil
).
Upvotes: 10
Views: 3914
Reputation: 1302
Make sure you are using the rspec-rails gem and are requiring 'rspec/rails' in your spec_helper, not just 'rspec'.
Upvotes: -2