From: misza222 <misza222@gmail.com>
To: Rack Development <rack-devel@googlegroups.com>
Subject: Re: Setting session from tests
Date: Tue, 9 Feb 2010 02:22:18 -0800 (PST) [thread overview]
Message-ID: <698008b7-8913-47cd-adb9-004fe9e437ba@m16g2000yqc.googlegroups.com> (raw)
In-Reply-To: <2fff50391002082346j692d4b58r205bc218e78ac52d@mail.gmail.com>
Thanks Daniel :)
On 9 Feb, 07:46, Daniel N <has....@gmail.com> wrote:
> When using rack test, it maintains a session for you.
>
> In the one test you should post the login deets, and then visit the
> URL you want to test.
>
> The session should be sticky between requests from within the same test
>
> hth
> Daniel
>
> On Tuesday, February 9, 2010, misza222 <misza...@gmail.com> wrote:
> > 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
>
>
prev parent reply other threads:[~2010-02-09 10:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-09 7:07 Setting session from tests misza222
2010-02-09 7:46 ` Daniel N
2010-02-09 10:22 ` misza222 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://groups.google.com/group/rack-devel
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=698008b7-8913-47cd-adb9-004fe9e437ba@m16g2000yqc.googlegroups.com \
--to=rack-devel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).