From 250fed7e04a234f81f6e58dbec7f9f4a723b35b1 Mon Sep 17 00:00:00 2001 From: James Mead Date: Mon, 4 Dec 2023 14:14:13 +0000 Subject: [PATCH] Improve mandate 2SV link text on edit user page As recommended by Etain and to match the title & heading of the page to which it links. --- app/helpers/users_helper.rb | 2 +- test/controllers/users_controller_test.rb | 2 +- test/helpers/users_helper_test.rb | 2 +- test/integration/managing_two_step_verification_test.rb | 4 ++-- test/support/managing_two_sv_helpers.rb | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index d11126070..e2a3a7c13 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -187,7 +187,7 @@ def link_to_mandate_2sv(user) return unless policy(user).mandate_2sv? return if user.require_2sv? - text = "Mandate 2-step verification for this user" + text = "Turn on 2-step verification for this user" text += " (this will remove their exemption)" if user.exempt_from_2sv? link_to text, edit_user_two_step_verification_mandation_path(user) end diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index 384e44224..a55baf54d 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -338,7 +338,7 @@ class UsersControllerTest < ActionController::TestCase get :edit, params: { id: user } - assert_select "a[href='#{edit_user_two_step_verification_mandation_path(user)}']", text: "Mandate 2-step verification for this user" + assert_select "a[href='#{edit_user_two_step_verification_mandation_path(user)}']", text: "Turn on 2-step verification for this user" end should "not be able to edit superadmins" do diff --git a/test/helpers/users_helper_test.rb b/test/helpers/users_helper_test.rb index 0a83678a3..39f55d740 100644 --- a/test/helpers/users_helper_test.rb +++ b/test/helpers/users_helper_test.rb @@ -409,7 +409,7 @@ class UsersHelperTest < ActionView::TestCase user = build(:user, id: 123) html = link_to_mandate_2sv(user) node = Nokogiri::HTML5.fragment(html) - expected_link_text = "Mandate 2-step verification for this user" + expected_link_text = "Turn on 2-step verification for this user" assert_select node, "a[href='#{edit_user_two_step_verification_mandation_path(user)}']", text: expected_link_text end diff --git a/test/integration/managing_two_step_verification_test.rb b/test/integration/managing_two_step_verification_test.rb index 6489ca813..aaaa0b167 100644 --- a/test/integration/managing_two_step_verification_test.rb +++ b/test/integration/managing_two_step_verification_test.rb @@ -117,7 +117,7 @@ class ManagingTwoStepVerificationTest < ActionDispatch::IntegrationTest non_admin_user = create(:user, organisation: @user.organisation) sign_in_as_and_edit_user(non_admin_user, @user) - assert page.has_no_text? "Mandate 2-step verification for this user" + assert page.has_no_text? "Turn on 2-step verification for this user" assert page.has_no_link? "Reset 2-step verification" end end @@ -140,7 +140,7 @@ class ManagingTwoStepVerificationTest < ActionDispatch::IntegrationTest sign_in_as_and_edit_user(@org_admin, user) assert page.has_text?(/2-step verification\s+Required but not set up/) - assert page.has_no_text? "Mandate 2-step verification for this user" + assert page.has_no_text? "Turn on 2-step verification for this user" end end end diff --git a/test/support/managing_two_sv_helpers.rb b/test/support/managing_two_sv_helpers.rb index f70e642da..1e91c2f7a 100644 --- a/test/support/managing_two_sv_helpers.rb +++ b/test/support/managing_two_sv_helpers.rb @@ -19,7 +19,7 @@ def assert_user_access_log_contains_messages(user, messages) end def mandate_2sv_for_exempted_user - click_link "Mandate 2-step verification for this user (this will remove their exemption)" + click_link "Turn on 2-step verification for this user (this will remove their exemption)" click_button "Turn on 2-step verification" end @@ -29,7 +29,7 @@ def admin_can_send_2sv_email(admin, user) assert page.has_text?(/2-step verification\s+Not set up/) perform_enqueued_jobs do - click_link "Mandate 2-step verification for this user" + click_link "Turn on 2-step verification for this user" click_button "Turn on 2-step verification" assert last_email