Create a Functional Test for Session Controller

10 views
Skip to first unread message

ayi budiawan

unread,
Sep 19, 2013, 10:05:57 AM9/19/13
to rubyonra...@googlegroups.com
Does anybody know how to make a functional test for this controller :

def create
user = User.authenticate(params[:email], params[:password])
if user
session[:user_id] = user.id
redirect_to root_url, :notice => "Logged in!"
else
flash.now.alert = "Invalid email or password"
render "new"
end
end

def destroy
session[:user_id] = nil
redirect_to root_url, :notice => "Logged out!"
end

I am so confused, because i am a newbie to ROR, please help me,
(urgent!)

--
Posted via http://www.ruby-forum.com/.

Colin Law

unread,
Sep 19, 2013, 3:55:29 PM9/19/13
to rubyonra...@googlegroups.com
Have you worked right through a good tutorial such as
railstutorial.org (which is free to use online)? This includes a good
introduction to testing.

Colin

and...@benjamin.dk

unread,
Sep 23, 2013, 9:11:57 PM9/23/13
to rubyonra...@googlegroups.com, cla...@googlemail.com
And the answer his dont re-invent the wheel, look at something called devise.
Reply all
Reply to author
Forward
0 new messages