# My login page has stopped accepting its title

**URL:** <https://www.ruby-forum.com/t/my-login-page-has-stopped-accepting-its-title/128361>\
**Category:** Rails\
**Created:** [February 7, 2008, 1:46am UTC](https://www.ruby-forum.com/t/my-login-page-has-stopped-accepting-its-title/128361 "2008-02-07T01:46:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![richardchaven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e480ec/32.png) [@richardchaven](https://www.ruby-forum.com/u/richardchaven)\
**Post date:** [February 7, 2008, 1:46am UTC](https://www.ruby-forum.com/t/my-login-page-has-stopped-accepting-its-title/128361/1 "2008-02-07T01:46:38Z")

</div>

well thanks for looking to start off with.

i have been following the railsspace book (building a social network in  
ruby on rails)

everything was working fine until i started the refactoring process.

now there are 2 failures in my tests.

1. the first failed test basicly says it was expecting xyz title but  
instead it was nil

2. and the second failed test says that it couldnt log in (was false -  
not true)

the test ruby code for the 1st failed test is:

# Make sure the login page works and has the right fields.

def test\_login\_page  
get :login  
title = assigns(:title)  
assert\_equal “Log in to Rood N Norty”, title  
assert\_response :success  
assert\_template “login”  
assert\_tag “form”, :attributes =\> { :action =\> “/user/login”,  
:method =\> “post” }  
assert\_tag “input”,  
:attributes =\> { :name =\> “user[screen\_name]”,  
:type =\> “text”,  
:size =\> User::SCREEN\_NAME\_SIZE,  
:maxlength =\> User::SCREEN\_NAME\_MAX\_LENGTH }  
assert\_tag “input”,  
:attributes =\> { :name =\> “user[password]”,  
:type =\> “password”,  
:size =\> User::PASSWORD\_SIZE,  
:maxlength =\> User::PASSWORD\_MAX\_LENGTH }  
assert\_tag “input”, :attributes =\> { :type =\> “submit”,  
:value =\> “Login!” }  
end

and the first part of the application layout view is:

 \<%= @title %\> \<%= stylesheet\_link\_tag "site" %\> \<%= javascript\_include\_tag :defaults %\> 

and the login part from the user controller is:

def login  
@title = “Log in to Rood N Norty”  
if request.post? and params[:user]  
@user = User.new(params[:user])  
user =  
User.find\_by\_screen\_name\_and\_password(@user.screen\_name,@user.password)  
if user  
user.login!(session)  
flash[:notice] = “User #{user.screen\_name} logged in!”  
if (redirect\_url = session[:protected\_page])  
session[:protected\_page] = nil  
redirect\_to redirect\_url  
else  
redirect\_to :action =\> “index”  
end  
else  
# Dont show the password in the view  
@user.clear\_password!  
flash[:notice] = “Invalid screen name/password combination”  
end  
end  
end

all the code that is above is to do with the first failure i believe, if  
anyone could be generous enough to have a quick look through to help me  
out, that would be amazing.
