Introduce current_user and prefs accessors that replace the @user and @prefs variables that were being used in most places.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@575 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-07-30 05:29:18 +00:00
parent ad5fbc7147
commit 30c23fc560
18 changed files with 233 additions and 207 deletions

View file

@ -114,6 +114,26 @@ class LoginControllerTest < Test::Rails::TestCase
assert !@controller.send(:logged_in?)
end
def test_current_user_nil
get :login
assert_nil @controller.current_user
end
def test_current_user_correct
user = login('jane','sesame', 'off')
assert_equal user, @controller.current_user
end
def test_prefs_nil
get :login
assert_nil @controller.prefs
end
def test_prefs_correct
user = login('jane','sesame', 'off')
assert_equal user.prefs, @controller.prefs
end
private
# Logs in a user and returns the user object found in the session object