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/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/0657c1037b9bff427af4b17569fc7bed%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.
On 19 September 2013 11:05, ayi budiawan <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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!)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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvQ-a9_kVWN64NiJwEMSaG3Z_mwrkDWS2j1utamkTx6xw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
andreo-FdlSlcb4kYpknbxzx/v8hQ@public.gmane.org
2013-Sep-23 21:11 UTC
Re: Create a Functional Test for Session Controller
And the answer his dont re-invent the wheel, look at something called devise. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5f955c29-e563-4127-b8ba-8b519ae09cf4%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.