X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e219916dcbb00fe179d27a3c1b32139c511f9c2e..9643e3393d546ae8a7bfb68ab52b5c72c92320b2:/test/controllers/users_controller_test.rb diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index feca92df5..c40c30b28 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -344,29 +344,29 @@ class UsersControllerTest < ActionController::TestCase end def test_logout_without_referer + post :logout + assert_response :redirect + assert_redirected_to root_path + end + + def test_logout_with_referer + post :logout, :params => { :referer => "/test" } + assert_response :redirect + assert_redirected_to "/test" + end + + def test_logout_fallback_without_referer get :logout assert_response :success assert_template :logout assert_select "input[name=referer][value=?]", "" - - session_id = assert_select("input[name=session]").first["value"] - - get :logout, :params => { :session => session_id } - assert_response :redirect - assert_redirected_to root_path end - def test_logout_with_referer + def test_logout_fallback_with_referer get :logout, :params => { :referer => "/test" } assert_response :success assert_template :logout assert_select "input[name=referer][value=?]", "/test" - - session_id = assert_select("input[name=session]").first["value"] - - get :logout, :params => { :session => session_id, :referer => "/test" } - assert_response :redirect - assert_redirected_to "/test" end def test_logout_with_token @@ -374,16 +374,7 @@ class UsersControllerTest < ActionController::TestCase session[:token] = token.token - get :logout - assert_response :success - assert_template :logout - assert_select "input[name=referer][value=?]", "" - assert_equal token.token, session[:token] - assert_not_nil UserToken.where(:id => token.id).first - - session_id = assert_select("input[name=session]").first["value"] - - get :logout, :params => { :session => session_id } + post :logout assert_response :redirect assert_redirected_to root_path assert_nil session[:token]