Request specs wrap Rails' integration tests, which simulate browser
interaction, but that's all. The idea is to not stub, simulate, etc,
anything internal at all. It's OK to create the `@user`, but cookies
should get set by making other requests that do so. Make sense?
_______________________________________________
rspec-users mailing list
rspec...@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
On 2/15/12 9:36 PM, Meltemi wrote:
> 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
In that snippit, "request" has not been constructed and therefore is nil.
- George
--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------