[rspec-users] How to set cookies before request spec?

Meltemi mdemetrios at gmail.com
Wed Feb 15 21:36:03 EST 2012


I can't seem to figure out how to set a cookie for a Request spec?  Tried:

before(:each) do
  @user = Fabricate(:user)
  request.cookies[:id_token] = @user.id
end

but that gives a NoMethodError errors: undefined method `cookies' for 
nil:NilClass 

How does one run request specs when cookies need to be simulated?
*Using Capybara if that matters*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120215/705bd7fc/attachment-0001.html>


More information about the rspec-users mailing list