summaryrefslogtreecommitdiffstats
path: root/test/functional/sessions_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-05-31 17:32:34 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-05-31 17:32:34 +0000
commitb834e81d7f41121fc6d9bef95ee090f8f466493e (patch)
tree61fddb6214c64e96fddd504301029bdb382ba439 /test/functional/sessions_controller_test.rb
parent1d4300b674f739d671a8be22d3ea617922f16517 (diff)
downloadredmine-b834e81d7f41121fc6d9bef95ee090f8f466493e.tar.gz
redmine-b834e81d7f41121fc6d9bef95ee090f8f466493e.zip
Use Rails 5 syntax for functional tests.
git-svn-id: http://svn.redmine.org/redmine/trunk@16585 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/sessions_controller_test.rb')
-rw-r--r--test/functional/sessions_controller_test.rb44
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