[rspec-users] How to set cookies before request spec?
dchelimsky at gmail.com
Thu Feb 16 07:59:19 EST 2012
On Wed, Feb 15, 2012 at 8:36 PM, Meltemi <mdemetrios at gmail.com> 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
> but that gives a NoMethodError errors: undefined method `cookies' for
> How does one run request specs when cookies need to be simulated?
> Using Capybara if that matters
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?
More information about the rspec-users