Skip to content

Commit

Permalink
Improve mandate 2SV link text on edit user page
Browse files Browse the repository at this point in the history
As recommended by Etain and to match the title & heading of the page to
which it links.
  • Loading branch information
floehopper committed Dec 5, 2023
1 parent 62971ec commit 250fed7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/helpers/users_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/users_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/users_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions test/integration/managing_two_step_verification_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/support/managing_two_sv_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 250fed7

Please sign in to comment.