From 5e73b5b2e533a81247ba0577de0aea1f39e89509 Mon Sep 17 00:00:00 2001 From: Paul Robert Lloyd Date: Mon, 20 Jun 2022 13:04:45 +0100 Subject: [PATCH] Use first or second person perspective when refering to users --- app/helpers/user_helper.rb | 4 ++-- app/views/users/edit.html.erb | 4 ++-- app/views/users/new.html.erb | 4 ++-- app/views/users/show.html.erb | 8 ++++---- spec/features/user_spec.rb | 8 ++++---- spec/helpers/user_helper_spec.rb | 10 ++++----- spec/requests/users_controller_spec.rb | 28 +++++++++++++------------- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/app/helpers/user_helper.rb b/app/helpers/user_helper.rb index 6f6853375..957e2dc2c 100644 --- a/app/helpers/user_helper.rb +++ b/app/helpers/user_helper.rb @@ -3,8 +3,8 @@ module UserHelper current_user == user ? edit_account_path : edit_user_path(user) end - def pronoun(user, current_user) - current_user == user ? "you" : "they" + def perspective(user, current_user) + current_user == user ? "Are you" : "Is this person" end def can_edit_names?(user, current_user) diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index da3cb51b0..900ca3a69 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -38,13 +38,13 @@ [OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")], :id, :name, - legend: { text: "Are #{pronoun(@user, current_user)} the organisation’s data protection officer?", size: "m" } %> + legend: { text: "#{perspective(@user, current_user)} the organisation’s data protection officer?", size: "m" } %> <%= f.govuk_collection_radio_buttons :is_key_contact, [OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")], :id, :name, - legend: { text: "Are #{pronoun(@user, current_user)} a key contact for this service?", size: "m" }, + legend: { text: "#{perspective(@user, current_user)} a key contact for this service?", size: "m" }, hint: { text: "This is a person responsible for sharing information about social housing lettings and sales data within the organisation." } %> <% end %> diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 06d71840e..3880a1e9f 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -55,13 +55,13 @@ [OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")], :id, :name, - legend: { text: "Are #{pronoun(@user, current_user)} the organisation’s data protection officer?", size: "m" } %> + legend: { text: "#{perspective(@user, current_user)} the organisation’s data protection officer?", size: "m" } %> <%= f.govuk_collection_radio_buttons :is_key_contact, [OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")], :id, :name, - legend: { text: "Is this user a key contact for this service?", size: "m" }, + legend: { text: "#{perspective(@user, current_user)} a key contact for this service?", size: "m" }, hint: { text: "This is a person responsible for sharing information about social housing lettings and sales data within the organisation." } %> <%= f.govuk_submit "Continue" %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 40bbdd146..06c528703 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -80,9 +80,9 @@ row.value { @user.is_data_protection_officer? ? "Yes" : "No" } if can_edit_dpo?(@user, current_user) row.action( - visually_hidden_text: "are #{pronoun(@user, current_user)} a data protection officer?", + visually_hidden_text: "if data protection officer", href: aliased_user_edit(@user, current_user), - html_attributes: { "data-qa": "change-are-#{pronoun(@user, current_user)}-a-data-protection-officer" }, + html_attributes: { "data-qa": "change-data-protection-officer" }, ) else row.action @@ -94,9 +94,9 @@ row.value { @user.is_key_contact? ? "Yes" : "No" } if can_edit_key_contact?(@user, current_user) row.action( - visually_hidden_text: "are #{pronoun(@user, current_user)} a key contact?", + visually_hidden_text: "if a key contact", href: aliased_user_edit(@user, current_user), - html_attributes: { "data-qa": "change-are-#{pronoun(@user, current_user)}-a-key-contact" }, + html_attributes: { "data-qa": "change-key-contact" }, ) else row.action diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index 63bddc885..566cdaa34 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -199,8 +199,8 @@ RSpec.describe "User Features" do it "does not have change links for dpo and key contact" do visit("/account") - expect(page).not_to have_selector('[data-qa="change-are-you-a-data-protection-officer"]') - expect(page).not_to have_selector('[data-qa="change-are-you-a-key-contact"]') + expect(page).not_to have_selector('[data-qa="change-if-data-protection-officer"]') + expect(page).not_to have_selector('[data-qa="change-if-key-contact"]') end it "does not have dpo and key contact as editable fields" do @@ -288,8 +288,8 @@ RSpec.describe "User Features" do it "has dpo and key contact as editable fields" do visit("/account") - expect(page).to have_selector('[data-qa="change-are-you-a-data-protection-officer"]') - expect(page).to have_selector('[data-qa="change-are-you-a-key-contact"]') + expect(page).to have_selector('[data-qa="change-data-protection-officer"]') + expect(page).to have_selector('[data-qa="change-key-contact"]') end end diff --git a/spec/helpers/user_helper_spec.rb b/spec/helpers/user_helper_spec.rb index 87d99f5ed..e49c7d6a2 100644 --- a/spec/helpers/user_helper_spec.rb +++ b/spec/helpers/user_helper_spec.rb @@ -20,18 +20,18 @@ RSpec.describe UserHelper do end end - describe "pronoun" do + describe "perspective" do context "when the current logged in user is the same as the user being viewed" do let(:user) { current_user } - it "returns 'you'" do - expect(pronoun(user, current_user)).to eq("you") + it "returns 'Are you'" do + expect(perspective(user, current_user)).to eq("Are you") end end context "when the current logged in user is not the same as the user being viewed" do - it "returns 'they'" do - expect(pronoun(user, current_user)).to eq("they") + it "returns 'Is this person'" do + expect(perspective(user, current_user)).to eq("Is this person") end end end diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index 047d89174..94f5d8fef 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -144,8 +144,8 @@ RSpec.describe UsersController, type: :request do expect(page).to have_link("Change", text: "email address") expect(page).to have_link("Change", text: "password") expect(page).not_to have_link("Change", text: "role") - expect(page).not_to have_link("Change", text: "are you a data protection officer?") - expect(page).not_to have_link("Change", text: "are you a key contact?") + expect(page).not_to have_link("Change", text: "if data protection officer") + expect(page).not_to have_link("Change", text: "if a key contact") end it "does not allow deactivating the user" do @@ -196,8 +196,8 @@ RSpec.describe UsersController, type: :request do expect(page).not_to have_link("Change", text: "email address") expect(page).not_to have_link("Change", text: "password") expect(page).not_to have_link("Change", text: "role") - expect(page).not_to have_link("Change", text: "are you a data protection officer?") - expect(page).not_to have_link("Change", text: "are you a key contact?") + expect(page).not_to have_link("Change", text: "if data protection officer") + expect(page).not_to have_link("Change", text: "if a key contact") end it "does not allow deactivating the user" do @@ -511,8 +511,8 @@ RSpec.describe UsersController, type: :request do expect(page).to have_link("Change", text: "email address") expect(page).to have_link("Change", text: "password") expect(page).to have_link("Change", text: "role") - expect(page).to have_link("Change", text: "are you a data protection officer?") - expect(page).to have_link("Change", text: "are you a key contact?") + expect(page).to have_link("Change", text: "if data protection officer") + expect(page).to have_link("Change", text: "if a key contact") end it "does not allow deactivating the user" do @@ -551,8 +551,8 @@ RSpec.describe UsersController, type: :request do expect(page).to have_link("Change", text: "email address") expect(page).not_to have_link("Change", text: "password") expect(page).to have_link("Change", text: "role") - expect(page).to have_link("Change", text: "are they a data protection officer?") - expect(page).to have_link("Change", text: "are they a key contact?") + expect(page).to have_link("Change", text: "if data protection officer") + expect(page).to have_link("Change", text: "if a key contact") end it "allows deactivating the user" do @@ -1168,8 +1168,8 @@ RSpec.describe UsersController, type: :request do expect(page).to have_link("Change", text: "email address") expect(page).to have_link("Change", text: "password") expect(page).to have_link("Change", text: "role") - expect(page).to have_link("Change", text: "are you a data protection officer?") - expect(page).to have_link("Change", text: "are you a key contact?") + expect(page).to have_link("Change", text: "if data protection officer") + expect(page).to have_link("Change", text: "if a key contact") end it "does not allow deactivating the user" do @@ -1197,8 +1197,8 @@ RSpec.describe UsersController, type: :request do expect(page).to have_link("Change", text: "email address") expect(page).not_to have_link("Change", text: "password") expect(page).to have_link("Change", text: "role") - expect(page).to have_link("Change", text: "are they a data protection officer?") - expect(page).to have_link("Change", text: "are they a key contact?") + expect(page).to have_link("Change", text: "if data protection officer") + expect(page).to have_link("Change", text: "if a key contact") end it "allows deactivating the user" do @@ -1237,8 +1237,8 @@ RSpec.describe UsersController, type: :request do expect(page).to have_link("Change", text: "email address") expect(page).not_to have_link("Change", text: "password") expect(page).to have_link("Change", text: "role") - expect(page).to have_link("Change", text: "are they a data protection officer?") - expect(page).to have_link("Change", text: "are they a key contact?") + expect(page).to have_link("Change", text: "if data protection officer") + expect(page).to have_link("Change", text: "if a key contact") end end end