From: Andy Allan Date: Wed, 14 Nov 2018 11:09:46 +0000 (+0100) Subject: Check that a request that requires authentication is redirected when the user hasn... X-Git-Tag: live~2804^2~2 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/d7f41756f9f8b61223b8bd04e7cadb34342dd4a1?hp=4deffa5e4024f53f7ca7191c52c01aaf85ab5f13 Check that a request that requires authentication is redirected when the user hasn't seen the terms --- diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index 20a04e90b..57dddc258 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -671,6 +671,17 @@ class UsersControllerTest < ActionController::TestCase assert_equal true, user.terms_seen end + # Check that if you haven't seen the terms, and make a request that requires authentication, + # that your request is redirected to view the terms + def test_terms_not_seen_redirection + user = create(:user, :terms_seen => false) + session[:user] = user.id + + get :account, :params => { :display_name => user.display_name } + assert_response :redirect + assert_redirected_to :action => :terms, :referer => "/user/#{ERB::Util.u(user.display_name)}/account" + end + def test_go_public user = create(:user, :data_public => false) post :go_public, :session => { :user => user }