On Apr 16, 2010, at 8:07 AM, Nicholas Wieland wrote:
> Hi *,
> I need to test cookie creation with rspec and using Rack::Test, but for some
> reason I'm not able to pair the real app that creates a cookie with the rspec
> tests.
> The spec is like this:
>
> it "should authenticate using cookies" do
> user = Factory.create :user
> remember_token = Charon.make_remember_token
> set_cookie "warden=#{ remember_token }"
> user.update :remember_token => remember_token
> post '/authenticate'
> last_request.env[ 'warden' ].should be_authenticated
> end
>
> Inside the main app I set the cookie like:
>
> if !request.cookies[ 'warden' ]
> response.set_cookie( 'warden', :value => env[ 'warden'
> ].user.remember_token )
> end
>
> I can clearly see it works when testing manually. For some reasons, the rspec
> cookie is different than the one set by the app.
>
> Is someone trying something similar and can share some code ? I think that
> the problem is in Rack::Test but I'm not sure and I'm not able prove it.
What versions of rails, rspec, rspec-rails, ruby, etc?
Where does this spec live?
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users