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:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title><%= @title %></title> <%= stylesheet_link_tag "site" %> <%= javascript_include_tag :defaults %> </head>
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.