From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.141.43.5 with SMTP id v5cs157536rvj; Tue, 9 Feb 2010 02:22:22 -0800 (PST) Received-SPF: pass (google.com: domain of 3XDdxSwgJClA40AHsKKKy4s03.u649su2-vwDw3y66y3wy96C7A.u64@groups.bounces.google.com designates 10.220.128.36 as permitted sender) client-ip=10.220.128.36; Authentication-Results: mr.google.com; spf=pass (google.com: domain of 3XDdxSwgJClA40AHsKKKy4s03.u649su2-vwDw3y66y3wy96C7A.u64@groups.bounces.google.com designates 10.220.128.36 as permitted sender) smtp.mail=3XDdxSwgJClA40AHsKKKy4s03.u649su2-vwDw3y66y3wy96C7A.u64@groups.bounces.google.com; dkim=pass header.i=3XDdxSwgJClA40AHsKKKy4s03.u649su2-vwDw3y66y3wy96C7A.u64@groups.bounces.google.com Received: from mr.google.com ([10.220.128.36]) by 10.220.128.36 with SMTP id i36mr344561vcs.48.1265710942376 (num_hops = 1); Tue, 09 Feb 2010 02:22:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:x-beenthere:received:received:received :received:received-spf:received:mime-version:received:date :in-reply-to:x-ip:references:user-agent:x-http-useragent:message-id :subject:from:to:x-original-authentication-results:x-original-sender :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:x-thread-url:x-message-url:sender:list-subscribe :list-unsubscribe:content-type; bh=dCfKlywDwwc2ln3eMTul8QXJL03GTgkDZxAEY66RyK0=; b=fKgNCFMir4d5QXYkK8OxhowPoO0Fy76LNs+Zh+VjUopjzYmaM9Ag00ve512m1iIeKS FuP+ept/D5attrhf8RRC94FJ03n7lAlYeUwdt5oQQoDrF1P62xPTJnmjKgz00sLntJGm tW9JuiqGuqVMU3saKSIMPxxLBbP9K80SUytCg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:mime-version:date:in-reply-to:x-ip :references:user-agent:x-http-useragent:message-id:subject:from:to :x-original-authentication-results:x-original-sender:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :x-thread-url:x-message-url:sender:list-subscribe:list-unsubscribe :content-type; b=UBFitUNv0i6wSNI3nHiCamV6qd5boYXWwKDBh3NSGopsJgr7URulh+4hQ8UbinP71B XY9pkxCH+XXxqfvdhLUpEvZQjgWkhA+5XfVKj66BXj0oa+rPnerLYxfyshk4XbhpEs2x jzJktQ5eaTHlmb6KhIrOKw1xhrJKsYz4FanmI= Received: by 10.220.128.36 with SMTP id i36mr35866vcs.48.1265710940922; Tue, 09 Feb 2010 02:22:20 -0800 (PST) X-BeenThere: rack-devel@googlegroups.com Received: by 10.220.68.219 with SMTP id w27ls871343vci.1.p; Tue, 09 Feb 2010 02:22:19 -0800 (PST) Received: by 10.220.3.213 with SMTP id 21mr1477434vco.4.1265710939078; Tue, 09 Feb 2010 02:22:19 -0800 (PST) Received: by 10.220.3.213 with SMTP id 21mr1477431vco.4.1265710938967; Tue, 09 Feb 2010 02:22:18 -0800 (PST) Return-Path: Received: from mail-yw0-f139.google.com (mail-yw0-f139.google.com [209.85.211.139]) by gmr-mx.google.com with ESMTP id 18si637594ywh.5.2010.02.09.02.22.18; Tue, 09 Feb 2010 02:22:18 -0800 (PST) Received-SPF: pass (google.com: domain of misza222@gmail.com designates 209.85.211.139 as permitted sender) client-ip=209.85.211.139; Received: by mail-yw0-f139.google.com with SMTP id 3so23782595ywh.20 for ; Tue, 09 Feb 2010 02:22:18 -0800 (PST) MIME-Version: 1.0 Received: by 10.100.238.2 with SMTP id l2mr658829anh.31.1265710938930; Tue, 09 Feb 2010 02:22:18 -0800 (PST) Date: Tue, 9 Feb 2010 02:22:18 -0800 (PST) In-Reply-To: <2fff50391002082346j692d4b58r205bc218e78ac52d@mail.gmail.com> X-IP: 82.71.41.52 References: <5b745a22-187a-457c-ab05-9856bd5eaaf4@u26g2000yqm.googlegroups.com> <2fff50391002082346j692d4b58r205bc218e78ac52d@mail.gmail.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.0.17) Gecko/2010010604 Ubuntu/9.04 (jaunty) Firefox/3.0.17,gzip(gfe),gzip(gfe) Message-ID: <698008b7-8913-47cd-adb9-004fe9e437ba@m16g2000yqc.googlegroups.com> Subject: Re: Setting session from tests From: misza222 To: Rack Development X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of misza222@gmail.com designates 209.85.211.139 as permitted sender) smtp.mail=misza222@gmail.com X-Original-Sender: misza222@gmail.com Reply-To: rack-devel@googlegroups.com Precedence: list Mailing-list: list rack-devel@googlegroups.com; contact rack-devel+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: X-Thread-Url: http://groups.google.com/group/rack-devel/t/ebd78f71ba7eb0b0 X-Message-Url: http://groups.google.com/group/rack-devel/msg/cd7e6f16b76ca4f5 Sender: rack-devel@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Type: text/plain; charset=ISO-8859-1 Thanks Daniel :) On 9 Feb, 07:46, Daniel N 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 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 > >