my login page has stopped accepting its title

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!" }

and the first part of the application layout view is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    <title><%= @title %></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 and params[:user]
      @user =[:user])
      user =
      if user
        flash[:notice] = "User #{user.screen_name} logged in!"
        if (redirect_url = session[:protected_page])
        session[:protected_page] = nil
        redirect_to redirect_url
        redirect_to :action => "index"
        # Dont show the password in the view
        flash[:notice] = "Invalid screen name/password combination"

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.