rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Setting session from tests
@ 2010-02-09  7:07 misza222
  2010-02-09  7:46 ` Daniel N
  0 siblings, 1 reply; 3+ messages in thread
From: misza222 @ 2010-02-09  7:07 UTC (permalink / raw)
  To: Rack Development

Hi,

How to set a session from within the tests?
I am using Rack::Test to test user authorization mechanism. I need to
make sure that user is redirected to the 'return_to' path which is
stored in a session.

post '/login', { :'user[email]' => @user.email, :'user[password]' =>
@user.password }

I tried creating mock request like

Rack::MockRequest.env_for("/login", {:"rack.session" => {:return_to =>
'/return_to'}})

and appending it as a 3rd parameter to the post method but no luck. It
was rather hit and miss approach as I don't really know how env is
organized :/

Can anyone help?

Cheers,

Michal

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-09 10:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-09  7:07 Setting session from tests misza222
2010-02-09  7:46 ` Daniel N
2010-02-09 10:22   ` misza222

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).