From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.141.43.5 with SMTP id v5cs145825rvj; Mon, 8 Feb 2010 23:46:49 -0800 (PST) Received-SPF: pass (google.com: domain of 35xJxSwcJCrYdWo.oktciWeh.YkinWYg-Zarahckkchacnkqlo.Yki@groups.bounces.google.com designates 10.114.3.34 as permitted sender) client-ip=10.114.3.34; Authentication-Results: mr.google.com; spf=pass (google.com: domain of 35xJxSwcJCrYdWo.oktciWeh.YkinWYg-Zarahckkchacnkqlo.Yki@groups.bounces.google.com designates 10.114.3.34 as permitted sender) smtp.mail=35xJxSwcJCrYdWo.oktciWeh.YkinWYg-Zarahckkchacnkqlo.Yki@groups.bounces.google.com; dkim=pass header.i=35xJxSwcJCrYdWo.oktciWeh.YkinWYg-Zarahckkchacnkqlo.Yki@groups.bounces.google.com Received: from mr.google.com ([10.114.3.34]) by 10.114.3.34 with SMTP id 34mr2846873wac.13.1265701609209 (num_hops = 1); Mon, 08 Feb 2010 23:46:49 -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:in-reply-to :references:date: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=H23eK+Zi+54q0pnmt8AUbqWFgDh0avixAyPNKzpEURY=; b=c2+tXruYvc4U2pfXh+BTp1IaE6UFA/FWLuEbcZTgN7ZO/SdNuBFUPu3NpZtzpcD6QM 0EzWKgYoNDT7qAbwDmKFPiI7mLjjVwKLXhgargn4njQReALrtdoyu0gzwZI3n10m96pa ST4EAEQV1Xmzq5a4YUMCP6N3iuLmP1sSzTHvY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:mime-version:in-reply-to:references:date :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=yrPda/p2nh7VY1XZNPjsnT8KPZHXdzZVqVubI6b48qtDk13OuFZNKNlqZu0FyommC6 1sFzBW+kT/npwTWvG0jp8x+qPM+dBZ4J4BbcFpItwd7XpNpmiPFZUKiGGWOP8oa+ZzrQ +XCWZ9mt4gqfC3J5fB/57MUun6zYSjMGZf2Fk= Received: by 10.114.3.34 with SMTP id 34mr424378wac.13.1265701607974; Mon, 08 Feb 2010 23:46:47 -0800 (PST) X-BeenThere: rack-devel@googlegroups.com Received: by 10.114.215.5 with SMTP id n5ls1030916wag.1.p; Mon, 08 Feb 2010 23:46:46 -0800 (PST) Received: by 10.115.5.18 with SMTP id h18mr1508184wai.19.1265701604148; Mon, 08 Feb 2010 23:46:44 -0800 (PST) Received: by 10.115.5.18 with SMTP id h18mr1508183wai.19.1265701604118; Mon, 08 Feb 2010 23:46:44 -0800 (PST) Return-Path: Received: from mail-pz0-f191.google.com (mail-pz0-f191.google.com [209.85.222.191]) by gmr-mx.google.com with ESMTP id 24si1313276pzk.2.2010.02.08.23.46.42; Mon, 08 Feb 2010 23:46:43 -0800 (PST) Received-SPF: pass (google.com: domain of has.sox@gmail.com designates 209.85.222.191 as permitted sender) client-ip=209.85.222.191; Received: by pzk29 with SMTP id 29so8249057pzk.17 for ; Mon, 08 Feb 2010 23:46:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.143.26.38 with SMTP id d38mr1135127wfj.218.1265701602732; Mon, 08 Feb 2010 23:46:42 -0800 (PST) In-Reply-To: <5b745a22-187a-457c-ab05-9856bd5eaaf4@u26g2000yqm.googlegroups.com> References: <5b745a22-187a-457c-ab05-9856bd5eaaf4@u26g2000yqm.googlegroups.com> Date: Tue, 9 Feb 2010 18:46:42 +1100 Message-ID: <2fff50391002082346j692d4b58r205bc218e78ac52d@mail.gmail.com> Subject: Re: Setting session from tests From: Daniel N To: rack-devel@googlegroups.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of has.sox@gmail.com designates 209.85.222.191 as permitted sender) smtp.mail=has.sox@gmail.com; dkim=pass (test mode) header.i=@gmail.com X-Original-Sender: has.sox@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/8ba6e4e31025eb9 Sender: rack-devel@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Type: text/plain; charset=ISO-8859-1 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 >