Create a Functional Test for Session Controller

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!)

On 19 September 2013 11:05, ayi budiawan [email protected] wrote:

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

And the answer his dont re-invent the wheel, look at something called
devise.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs