Message from discussion
Logging in
Received: by 10.216.179.79 with SMTP id g57mr92884wem.12.1298020389597;
Fri, 18 Feb 2011 01:13:09 -0800 (PST)
X-BeenThere: steakrb@googlegroups.com
Received: by 10.216.189.234 with SMTP id c84ls1176050wen.2.p; Fri, 18 Feb 2011
01:13:08 -0800 (PST)
Received: by 10.216.165.15 with SMTP id d15mr27180wel.2.1298020388959;
Fri, 18 Feb 2011 01:13:08 -0800 (PST)
Received: by 10.216.165.15 with SMTP id d15mr27179wel.2.1298020388926;
Fri, 18 Feb 2011 01:13:08 -0800 (PST)
Return-Path: <senor.j.on...@gmail.com>
Received: from mail-ww0-f52.google.com (mail-ww0-f52.google.com [74.125.82.52])
by gmr-mx.google.com with ESMTPS id l26si235612weq.14.2011.02.18.01.13.08
(version=TLSv1/SSLv3 cipher=OTHER);
Fri, 18 Feb 2011 01:13:08 -0800 (PST)
Received-SPF: pass (google.com: domain of senor.j.on...@gmail.com designates 74.125.82.52 as permitted sender) client-ip=74.125.82.52;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of senor.j.on...@gmail.com designates 74.125.82.52 as permitted sender) smtp.mail=senor.j.on...@gmail.com; dkim=pass (test mode) header...@gmail.com
Received: by mail-ww0-f52.google.com with SMTP id 20so3609721wwd.33
for <steakrb@googlegroups.com>; Fri, 18 Feb 2011 01:13:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;
h=domainkey-signature:date:from:to:message-id:in-reply-to:references
:subject:x-mailer:mime-version:content-type
:content-transfer-encoding;
bh=z/REXBQpyD6kzhUkPSDY6tLrNZIfYr8HrCP7EfA4mh4=;
b=kaXnwWefa+YY+kxoCydZuA/GIH/gsbCCmsyO1aDQXwVVRA2UWX6AApklUGRdTc07Zt
luxae/vyd10zDuupkVN3TfrP6As7vYde+Lvty/YYIJ7IV0ytEkuGUaz9YumsoM933PLu
ogtYBLwy8JZm/+ROIPo84BJEKaFqymqGkBk5o=
DomainKey-Signature: a=rsa-sha1; c=nofws;
d=gmail.com; s=gamma;
h=date:from:to:message-id:in-reply-to:references:subject:x-mailer
:mime-version:content-type:content-transfer-encoding;
b=UNDWAZxfk7SMchhtEhBByMc7HN1SBkVJ2F6JwAvOPD7aGo8RBrY/CIcMiv4rL+3/nQ
ucVoJ91ml8CLepR1cXgrjVsxm/X4rjL+KhtIothOGsjvwzaDRQHGtoArwNIhAOuo2F10
TCPBbV7c6lGIBQI30KC1RGpseTwfcoXYPK/Ls=
Received: by 10.216.154.8 with SMTP id g8mr1318279wek.12.1298020388752;
Fri, 18 Feb 2011 01:13:08 -0800 (PST)
Return-Path: <senor.j.on...@gmail.com>
Received: from Joergs-MacBook-Pro.local (41-133-183-175.dsl.mweb.co.za [41.133.183.175])
by mx.google.com with ESMTPS id j49sm764274wer.38.2011.02.18.01.13.05
(version=TLSv1/SSLv3 cipher=OTHER);
Fri, 18 Feb 2011 01:13:07 -0800 (PST)
Date: Fri, 18 Feb 2011 11:13:03 +0200
From: "=?utf-8?Q?Se=C3=B1or_J._Onion?=" <senor.j.on...@gmail.com>
To: steakrb@googlegroups.com
Message-ID: <405F0E8D13234536882AC5D9CB7C9...@gmail.com>
In-Reply-To: <AANLkTikUTZVSedNXfuSY4TP60CSUNZQ6Gspp1tY+i...@mail.gmail.com>
References: <e8cd958a-4d16-4111-ac54-61fd00424...@4g2000yqo.googlegroups.com>
<AANLkTikUTZVSedNXfuSY4TP60CSUNZQ6Gspp1tY+i...@mail.gmail.com>
Subject: Re: [steakrb] Logging in
X-Mailer: sparrow 1.0.1 (build 589.15)
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="4d5e381f_4f4ef005_6160"
Content-Transfer-Encoding: 8bit
--4d5e381f_4f4ef005_6160
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Yeah I suppose that is one way to do it to go through the actual logging in process - but ideally I'd just like to set the logged in user via Warden.
It works using the Devise signin_as helpers for the controller specs. But the Steak acceptance tests I don't have access to the controller so I can't use those helpers and need to rely on the warden helpers ... but they don't seem to work as any url I visit I just get redirected to the sign in page.
On Thursday, 17 February 2011 at 19:31, David Kahn wrote:
>
> On Thu, Feb 17, 2011 at 11:04 AM, Joerg <senor.j.on...@gmail.com> wrote:
> > Hi - I just can't seem to get my acceptance tests to log me in.
> >
> > I have this in the helper:
> > config.include Warden::Test::Helpers, :type => :acceptance
> >
> > And this before my tests ...
> >
> > background :each do
> > @admin = Factory.create(:admin)
> > login_as @admin
> > end
> >
> > There are no errors, however when I visit a URL - it sends me back to
> > the sign_in page ... I've run out of ideas of how to figure out why it
> > doesn't log me in ... So close to changing away from cucumber.
> >
> > I am using Rails 3 and Rspec 2. And
> >
> > warden (1.0.3)
> > rack (>= 1.0.0)
>
> Not sure if this will help you, but in acceptance/support I created a 'login_helper.rb' which takes the actions to log me in:
>
> def login_as_valid_user
> user = Factory.create(:user)
> login_as_specific_user(user.email)
> user
> end
>
> def login_as_specific_user(email)
> user = User.find_by_email(email)
> visit('/login')
> fill_in('Email', :with => user.email)
> fill_in('Password', :with => 'Password1')
> click_button('Login')
> user
> end
>
> Then from my steak spec I can call:
>
> login_as_valid_user OR
>
> login_as_specific_user(d...@structuralartistry.com)
>
>
> Unless I am missing voodoo with Steak, you need to create these actions yourself.
>
> >
> >
> > Thanks
> >
>
--4d5e381f_4f4ef005_6160
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
<div>
<div>
<span>Yeah I suppose that is one way to do it to go throu=
gh the actual logging in process - but ideally I'd just like to set the l=
ogged in user via Warden.<div><br></div><div>It works using the Devise si=
gnin=5Fas helpers for the controller specs. But the Steak acceptance test=
s I don't have access to the controller so I can't use those helpers and =
need to rely on the warden helpers ... but they don't seem to work as any=
url I visit I just get redirected to the sign in page.</div></span>
<span></span>
=20
<p style=3D=22color: =23a0a0a0;=22>On Thursday, 17 =46ebr=
uary 2011 at 19:31, David Kahn wrote:</p>
<blockquote type=3D=22cite=22 style=3D=22border-left-styl=
e:solid;border-width:1px;margin-left:0px;padding-left:10px;=22>
<span><div><div><br><br><div class=3D=22gmail=5Fquote=
=22>On Thu, =46eb 17, 2011 at 11:04 AM, Joerg <span dir=3D=22ltr=22><<=
a href=3D=22mailto:senor.j.onion=40gmail.com=22>senor.j.onion=40gmail.com=
</a>></span> wrote:<br><blockquote type=3D=22cite=22><div>
Hi - I just can't seem to get my acceptance tests to log me in.<br>
<br>
I have this in the helper:<br>
config.include Warden::Test::Helpers, :type =3D> :acceptance<br>
<br>
And this before my tests ...<br>
<br>
background :each do<br>
=40admin =3D =46actory.create(:admin)<br>
login=5Fas =40admin<br>
end<br>
<br>
There are no errors, however when I visit a URL - it sends me back to<br>=
the sign=5Fin page ... I've run out of ideas of how to figure out why it<=
br>
doesn't log me in ... So close to changing away from cucumber.<br>
<br>
I am using Rails 3 and Rspec 2. And<br>
<br>
warden (1.0.3)<br>
rack (>=3D 1.0.0)<br></div></blockquote><div><br>=
Not sure if this will help you, but in acceptance/support I created a 'lo=
gin=5Fhelper.rb' which takes the actions to log me in:<br><br>def login=5F=
as=5Fvalid=5Fuser<br> user =3D =46actory.create(:user)<br>
login=5Fas=5Fspecific=5Fuser(user.email)<br> user<br>end<br>=
<br>def login=5Fas=5Fspecific=5Fuser(email)<br> user =3D User.find=5F=
by=5Femail(email)<br> visit('/login')<br> fill=5Fin('Email', =
:with =3D> user.email)<br> fill=5Fin('Password', :with =3D> '=
Password1')<br>
click=5Fbutton('Login')<br> user<br>end<br><br>Then from my =
steak spec I can call:<br><br>login=5Fas=5Fvalid=5Fuser OR<br=
><br>login=5Fas=5Fspecific=5Fuser(<a href=3D=22mailto:dk=40structuralarti=
stry.com=22>dk=40structuralartistry.com</a>)<br>
<br><br>Unless I am missing voodoo with Steak, you need to create t=
hese actions yourself.<br><br></div><blockquote type=3D=22cite=22><div>
<br>
<br>
Thanks<br>
</div></blockquote></div><br>
</div></div></span>
=20
=20
=20
=20
</blockquote>
=20
<div>
<br>
</div>
</div>
</div>
--4d5e381f_4f4ef005_6160--