From c8f986a7ec74eefa6ce0d875e190637673e39db2 Mon Sep 17 00:00:00 2001 From: bsag Date: Thu, 2 Feb 2006 17:37:46 +0000 Subject: [PATCH] Added clarsen's patch for the login_controller_test to test the new session functionality (#199). Thanks, clarsen. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@181 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/test/functional/login_controller_test.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tracks/test/functional/login_controller_test.rb b/tracks/test/functional/login_controller_test.rb index 407e1265..591505c5 100644 --- a/tracks/test/functional/login_controller_test.rb +++ b/tracks/test/functional/login_controller_test.rb @@ -9,6 +9,9 @@ class LoginControllerTest < Test::Unit::TestCase fixtures :users def setup + assert_equal "test", ENV['RAILS_ENV'] + app_configurations["admin"]["loginhash"] = "change-me" + assert_equal "change-me", app_configurations["admin"]["loginhash"] @controller = LoginController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @@ -22,8 +25,9 @@ class LoginControllerTest < Test::Unit::TestCase end def test_login_with_valid_admin_user + assert_equal "change-me", app_configurations["admin"]["loginhash"] user = login('admin','abracadabra') - assert_equal "Login successful", flash['notice'] + assert_equal "Login successful: session will expire after 1 hour of inactivity.", flash['notice'] assert_redirected_to :controller => 'todo', :action => 'list' assert_equal 'admin', user.login assert_equal 1, user.is_admin @@ -32,7 +36,7 @@ class LoginControllerTest < Test::Unit::TestCase def test_login_with_valid_standard_user user = login('jane','sesame') - assert_equal "Login successful", flash['notice'] + assert_equal "Login successful: session will expire after 1 hour of inactivity.", flash['notice'] assert_redirected_to :controller => 'todo', :action => 'list' assert_equal 'jane', user.login assert_equal 0, user.is_admin @@ -43,7 +47,7 @@ class LoginControllerTest < Test::Unit::TestCase user = login('admin','abracadabra') get :logout assert_nil(session['user']) - assert_template 'logout' + assert_redirected_to :controller => 'login', :action => 'login' end # TODO: Not sure how to test whether the user is blocked if the admin user is