[Rails] functional test problems
Scott Barron
scott at elitists.net
Thu Nov 11 12:19:11 GMT 2004
On Thu, Nov 11, 2004 at 12:12:37PM +0100, Johan Sörensen wrote:
> Hi list.
>
> Just starting to wrap my heads around the whole unit testing deal.
> I've run into a bit of a (small) problem when testing a
> LoginController.
>
> my main login method that I'm looking to test looks like this:
> def checkauth
> if currentuser = User.checkauth(@params["login"]["username"],
> @params["login"]["password"])
> @session["user_id"] = currentuser.id
> @session["username"] = currentuser.username
> # some more stuff, like redirects on sucess etc
> end
>
> and my simple testcase looks like this:
> def test_session_vars
> process 'checkauth', "username" => 'foo', "password" => 'bar'
Hi,
Make that:
process :checkauth, 'login' => {'username' => 'foo', 'password' => 'bar'}
> PS. Thanks Steve Kellock for writing that testing tutorial PDF, it
> explains the concepts really well..
Yeah, it rocks. I just went through a ton of my FT's yesterday making
them use these wonderful new features. Glorious.
-Scott
More information about the Rails
mailing list