rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: misza222 <misza222@gmail.com>
To: Rack Development <rack-devel@googlegroups.com>
Subject: Setting session from tests
Date: Mon, 8 Feb 2010 23:07:05 -0800 (PST)	[thread overview]
Message-ID: <5b745a22-187a-457c-ab05-9856bd5eaaf4@u26g2000yqm.googlegroups.com> (raw)

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

             reply	other threads:[~2010-02-09  7:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-09  7:07 misza222 [this message]
2010-02-09  7:46 ` Setting session from tests Daniel N
2010-02-09 10:22   ` misza222

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=5b745a22-187a-457c-ab05-9856bd5eaaf4@u26g2000yqm.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).