diff options
Diffstat (limited to 'test/functional/sessions_controller_test.rb')
-rw-r--r-- | test/functional/sessions_controller_test.rb | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/test/functional/sessions_controller_test.rb b/test/functional/sessions_controller_test.rb index f362947b5..bcc182ccc 100644 --- a/test/functional/sessions_controller_test.rb +++ b/test/functional/sessions_controller_test.rb @@ -35,7 +35,10 @@ class SessionsControllerTest < Redmine::ControllerTest token = Token.create!(:user_id => 2, :action => 'session', :created_on => 10.hours.ago, :updated_on => 10.hours.ago) created = token.reload.created_on - get :index, :session => {:user_id => 2, :tk => token.value} + get :index, :session => { + :user_id => 2, + :tk => token.value + } assert_response :success token.reload assert_equal created.to_i, token.created_on.to_i @@ -48,13 +51,18 @@ class SessionsControllerTest < Redmine::ControllerTest token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created) with_settings :session_lifetime => '0', :session_timeout => '0' do - get :index, :session => {:user_id => 2, :tk => token.value} + get :index, :session => { + :user_id => 2, + :tk => token.value + } assert_response :success end end def test_user_session_without_token_should_be_reset - get :index, :session => {:user_id => 2} + get :index, :session => { + :user_id => 2 + } assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F' end @@ -63,7 +71,10 @@ class SessionsControllerTest < Redmine::ControllerTest token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created) with_settings :session_timeout => '720' do - get :index, :session => {:user_id => 2, :tk => token.value} + get :index, :session => { + :user_id => 2, + :tk => token.value + } assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F' end end @@ -73,7 +84,10 @@ class SessionsControllerTest < Redmine::ControllerTest token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created) with_settings :session_timeout => '720' do - get :index, :session => {:user_id => 2, :tk => token.value} + get :index, :session => { + :user_id => 2, + :tk => token.value + } assert_response :success end end @@ -83,7 +97,10 @@ class SessionsControllerTest < Redmine::ControllerTest token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created) with_settings :session_timeout => '60' do - get :index, :session => {:user_id => 2, :tk => token.value} + get :index, :session => { + :user_id => 2, + :tk => token.value + } assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F' end end @@ -93,7 +110,10 @@ class SessionsControllerTest < Redmine::ControllerTest token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created) with_settings :session_timeout => '60' do - get :index, :session => {:user_id => 2, :tk => token.value} + get :index, :session => { + :user_id => 2, + :tk => token.value + } assert_response :success end end @@ -106,7 +126,10 @@ class SessionsControllerTest < Redmine::ControllerTest autologin_token = Token.create!(:user_id => 2, :action => 'autologin', :created_on => 1.day.ago) @request.cookies['autologin'] = autologin_token.value - get :index, :session => {:user_id => 2, :tk => token.value} + get :index, :session => { + :user_id => 2, + :tk => token.value + } assert_equal 2, session[:user_id] assert_response :success assert_not_equal token.value, session[:tk] @@ -122,7 +145,10 @@ class SessionsControllerTest < Redmine::ControllerTest token = Token.create!(:user_id => 2, :action => 'session', :created_on => created, :updated_on => created) with_settings :session_timeout => '60' do - get :index, :session => {:user_id => user.id, :tk => token.value} + get :index, :session => { + :user_id => user.id, + :tk => token.value + } assert_redirected_to 'http://test.host/login?back_url=http%3A%2F%2Ftest.host%2F' assert_include "Veuillez vous reconnecter", flash[:error] assert_equal :fr, current_language |