Rspec: setting cookies in a helper test?

You get the cookies the same way you set them. Example from one of my specs.

You get the cookies the same way you set them. Example from one of my specs: request. Cookies:email.

Should be nil.

Strange. If I place that in my helper spec, I get "undefined local variable or method `request'". If I change it to helper.

Request I get nil (though it works fine functionally and the code is solid). Argh. – jmccartie Apr 1 at 4:14 here's the spec I'm trying to run and its results: gist.github.Com/897722 – jmccartie Apr 1 at 4:19.

The best explanation I've been able to find is here: https://relishapp.com/rspec/rspec-rails/docs/con... Quoted: Recommended guidelines for rails-3.0.0 to 3.1.0 Access cookies through the request and response objects in the spec. Use request. Cookies before the action to set up state.

Use response. Cookies after the action to specify outcomes. Use the cookies object in the controller action.

Use String keys. Example: # spec request. Cookies'foo' = 'bar' get :some_action response.

Cookies'foo'. Should eq('modified bar') # controller def some_action cookies'foo' = "modified #{cookies'foo'}" end.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions