From 7b5ba6bbed52932d7770cf535d9e53828dc31c06 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Mon, 17 Feb 2025 15:56:17 +0100 Subject: [PATCH] Use FullNameFormatter This updates the various places in the service where a name is rendered to use the new `FullNameFormatter` class to ensure that it's formatted correctly. --- .../app_consent_confirmation_component.rb | 7 ++- .../app_simple_status_banner_component.rb | 2 +- app/lib/govuk_notify_personalisation.rb | 6 +- app/models/concerns/full_name_concern.rb | 11 ++-- ...vaccination_record_performed_by_concern.rb | 15 +++-- .../consent_forms/confirm.html.erb | 4 +- .../app_activity_log_component_spec.rb | 24 ++++---- ...consent_form_and_patient_component_spec.rb | 4 +- ..._consent_patient_summary_component_spec.rb | 4 +- .../app_outcome_banner_component_spec.rb | 6 +- .../app_patient_summary_component_spec.rb | 6 +- .../app_patient_table_component_spec.rb | 6 +- .../app_timestamped_entry_component_spec.rb | 2 +- .../app_triage_notes_component_spec.rb | 4 +- ...ccination_record_summary_component_spec.rb | 13 +++- ...vaccination_record_table_component_spec.rb | 4 +- .../concerns/patient_sorting_concern_spec.rb | 29 +++++---- spec/factories/users.rb | 3 +- spec/features/e2e_journey_spec.rb | 8 +-- spec/features/edit_vaccination_record_spec.rb | 6 +- .../import_child_records_slow_spec.rb | 6 +- spec/features/import_child_records_spec.rb | 6 +- ...port_child_records_with_duplicates_spec.rb | 12 ++-- spec/features/import_class_lists_spec.rb | 6 +- ...import_class_lists_with_duplicates_spec.rb | 12 ++-- .../import_vaccination_records_spec.rb | 10 ++-- ...accination_records_with_duplicates_spec.rb | 4 +- spec/features/manage_children_spec.rb | 10 ++-- spec/features/parental_consent_clinic_spec.rb | 4 +- .../parental_consent_create_patient_spec.rb | 2 +- .../features/parental_consent_doubles_spec.rb | 4 +- .../parental_consent_home_educated_spec.rb | 4 +- .../features/parental_consent_refused_spec.rb | 2 +- ...l_consent_school_session_completed_spec.rb | 6 +- .../parental_consent_send_request_spec.rb | 4 +- spec/features/parental_consent_spec.rb | 4 +- spec/features/patient_search_spec.rb | 60 +++++++++---------- spec/features/td_ipv_already_had_spec.rb | 2 +- .../triage_partially_vaccinated_spec.rb | 2 +- ...iage_then_parental_consent_refused_spec.rb | 3 +- ...is2_authentication_from_start_page_spec.rb | 6 +- ..._cis2_authentication_with_redirect_spec.rb | 10 ++-- .../programme_vaccinations_exporter_spec.rb | 4 +- spec/models/class_import_spec.rb | 12 ++-- spec/models/cohort_import_spec.rb | 9 ++- spec/models/consent_form_spec.rb | 2 +- spec/models/immunisation_import_row_spec.rb | 3 +- spec/models/vaccination_record_spec.rb | 4 +- 48 files changed, 206 insertions(+), 171 deletions(-) diff --git a/app/components/app_consent_confirmation_component.rb b/app/components/app_consent_confirmation_component.rb index fba2788cd..f2ae0683d 100644 --- a/app/components/app_consent_confirmation_component.rb +++ b/app/components/app_consent_confirmation_component.rb @@ -37,13 +37,16 @@ def title private - delegate :full_name, - :chosen_programmes, + delegate :chosen_programmes, :not_chosen_programmes, :response, :parent_email, to: :@consent_form + def full_name + @consent_form.full_name(context: :parents) + end + def panel_text case response when "given", "given_one" diff --git a/app/components/app_simple_status_banner_component.rb b/app/components/app_simple_status_banner_component.rb index 1e49a1287..21d4d83b0 100644 --- a/app/components/app_simple_status_banner_component.rb +++ b/app/components/app_simple_status_banner_component.rb @@ -30,7 +30,7 @@ def call delegate :patient, :session, to: :patient_session def status - @status ||= @patient_session.status(programme:) + @status ||= patient_session.status(programme:) end def colour diff --git a/app/lib/govuk_notify_personalisation.rb b/app/lib/govuk_notify_personalisation.rb index a9ef311ee..61b267c68 100644 --- a/app/lib/govuk_notify_personalisation.rb +++ b/app/lib/govuk_notify_personalisation.rb @@ -123,10 +123,10 @@ def full_and_preferred_patient_name patient_or_consent_form = consent_form || patient if patient_or_consent_form.has_preferred_name? - patient_or_consent_form.full_name + - " (known as #{patient_or_consent_form.preferred_full_name})" + patient_or_consent_form.full_name(context: :parents) + + " (known as #{patient_or_consent_form.preferred_full_name(context: :parents)})" else - patient_or_consent_form.full_name + patient_or_consent_form.full_name(context: :parents) end end diff --git a/app/models/concerns/full_name_concern.rb b/app/models/concerns/full_name_concern.rb index cbc2ed437..6e4650068 100644 --- a/app/models/concerns/full_name_concern.rb +++ b/app/models/concerns/full_name_concern.rb @@ -8,19 +8,16 @@ module FullNameConcern -> { order("LOWER(family_name)", "LOWER(given_name)") } end - def full_name - [given_name, family_name].join(" ") + def full_name(context: :internal) + FullNameFormatter.call(self, context:) end def has_preferred_name? preferred_given_name.present? || preferred_family_name.present? end - def preferred_full_name - [ - preferred_given_name.presence || given_name, - preferred_family_name.presence || family_name - ].join(" ") + def preferred_full_name(context: :internal) + FullNameFormatter.call(self, context:, parts_prefix: :preferred) end def preferred_full_name_changed? diff --git a/app/models/concerns/vaccination_record_performed_by_concern.rb b/app/models/concerns/vaccination_record_performed_by_concern.rb index 409ba7758..150a43fca 100644 --- a/app/models/concerns/vaccination_record_performed_by_concern.rb +++ b/app/models/concerns/vaccination_record_performed_by_concern.rb @@ -11,17 +11,20 @@ module VaccinationRecordPerformedByConcern } end + PerformedBy = + Struct.new(:given_name, :family_name) do + def full_name + FullNameFormatter.call(self, context: :internal) + end + end + def performed_by return performed_by_user if performed_by_user if performed_by_given_name.present? || performed_by_family_name.present? - OpenStruct.new( + PerformedBy.new( given_name: performed_by_given_name, - family_name: performed_by_family_name, - full_name: [ - performed_by_given_name, - performed_by_family_name - ].compact_blank.join(" ") + family_name: performed_by_family_name ) end end diff --git a/app/views/parent_interface/consent_forms/confirm.html.erb b/app/views/parent_interface/consent_forms/confirm.html.erb index d891acbad..d66ea301a 100644 --- a/app/views/parent_interface/consent_forms/confirm.html.erb +++ b/app/views/parent_interface/consent_forms/confirm.html.erb @@ -139,7 +139,7 @@ <%= govuk_summary_list do |summary_list| summary_list.with_row do |row| row.with_key { "Child’s name" } - row.with_value { @consent_form.full_name } + row.with_value { @consent_form.full_name(context: :parents) } row.with_action(text: "Change", href: change_link[:name], visually_hidden_text: "child’s name") @@ -148,7 +148,7 @@ if @consent_form.use_preferred_name summary_list.with_row do |row| row.with_key { "Also known as" } - row.with_value { @consent_form.preferred_full_name } + row.with_value { @consent_form.preferred_full_name(context: :parents) } row.with_action(text: "Change", href: change_link[:name], visually_hidden_text: "common name") diff --git a/spec/components/app_activity_log_component_spec.rb b/spec/components/app_activity_log_component_spec.rb index f07d5b1d7..a9555c55f 100644 --- a/spec/components/app_activity_log_component_spec.rb +++ b/spec/components/app_activity_log_component_spec.rb @@ -143,7 +143,7 @@ title: "Vaccinated with Gardasil 9", date: "31 May 2024 at 12:00pm", notes: "Some notes", - by: "Nurse Joy", + by: "JOY, Nurse", programme: "HPV" include_examples "card", @@ -155,14 +155,14 @@ include_examples "card", title: "Triaged decision: Safe to vaccinate", date: "30 May 2024 at 2:30pm", - by: "Nurse Joy", + by: "JOY, Nurse", programme: "HPV" include_examples "card", title: "Triaged decision: Keep in triage", date: "30 May 2024 at 2:00pm", notes: "Some notes", - by: "Nurse Joy", + by: "JOY, Nurse", programme: "HPV" include_examples "card", @@ -173,7 +173,7 @@ include_examples "card", title: "Consent given by Jane Doe (Mum)", date: "30 May 2024 at 12:00pm", - by: "Nurse Joy", + by: "JOY, Nurse", programme: "HPV" include_examples "card", @@ -184,7 +184,7 @@ title: "Consent school request hpv sent", date: "10 May 2024 at 12:00am", notes: "test@example.com", - by: "Nurse Joy", + by: "JOY, Nurse", programme: "HPV" end @@ -207,7 +207,7 @@ title: "Vaccination not given: Unwell", date: "31 May 2024 at 1:00pm", notes: "Some notes.", - by: "Nurse Joy", + by: "JOY, Nurse", programme: "HPV" end @@ -228,7 +228,7 @@ include_examples "card", title: "Vaccinated with Gardasil 9", date: "31 May 2024 at 1:00pm", - by: "Nurse Joy", + by: "JOY, Nurse", programme: "HPV" include_examples "card", @@ -251,7 +251,7 @@ include_examples "card", title: - "Consent given by Sarah Doe (Child (Gillick competent))", + "Consent given by DOE, Sarah (Child (Gillick competent))", date: "30 May 2024 at 12:00pm", programme: "HPV" end @@ -290,7 +290,7 @@ title: "Consent response manually matched with child record", date: "30 May 2024 at 1:00pm", - by: "Nurse Joy" + by: "JOY, Nurse" end describe "withdrawn consent" do @@ -370,7 +370,7 @@ title: "Completed Gillick assessment as Gillick competent", notes: "First notes", date: "1 June 2024 at 12:00pm", - by: "Nurse Joy", + by: "JOY, Nurse", programme: "Td/IPV" include_examples "card", @@ -378,7 +378,7 @@ "Updated Gillick assessment as not Gillick competent", notes: "Second notes", date: "1 June 2024 at 1:00pm", - by: "Nurse Joy", + by: "JOY, Nurse", programme: "Td/IPV" end @@ -400,6 +400,6 @@ title: "Completed pre-screening checks", notes: "Some notes", date: "1 June 2024 at 12:00pm", - by: "Nurse Joy" + by: "JOY, Nurse" end end diff --git a/spec/components/app_compare_consent_form_and_patient_component_spec.rb b/spec/components/app_compare_consent_form_and_patient_component_spec.rb index 7d74eea12..b5ab3de09 100644 --- a/spec/components/app_compare_consent_form_and_patient_component_spec.rb +++ b/spec/components/app_compare_consent_form_and_patient_component_spec.rb @@ -36,7 +36,7 @@ end it "displays the key consent form details without anything being highlighted as unmatched" do - expect(rendered).to have_text("Full name\nJohn Doe\nJohn Doe") + expect(rendered).to have_text("Full name\nDOE, John\nDOE, John") expect(rendered).to have_text( "Date of birth\n1 January 2000\n1 January 2000" ) @@ -67,7 +67,7 @@ end it "displays the key consent form details with the unmatched details highlighted" do - expect(rendered).to have_text("Full name\nJohn Doe\nJane Doe") + expect(rendered).to have_text("Full name\nDOE, John\nDOE, Jane") expect(rendered).to have_text( "Date of birth\n1 January 2000\n2 January 2000" ) diff --git a/spec/components/app_consent_patient_summary_component_spec.rb b/spec/components/app_consent_patient_summary_component_spec.rb index 77692ecd7..d61674b24 100644 --- a/spec/components/app_consent_patient_summary_component_spec.rb +++ b/spec/components/app_consent_patient_summary_component_spec.rb @@ -31,7 +31,7 @@ end it { should have_content("Full name") } - it { should have_content("John Doe") } + it { should have_content("DOE, John") } it { should have_content("Date of birth") } it { should have_content("1 January 2000") } @@ -57,7 +57,7 @@ end it { should have_content("Full name") } - it { should have_content("John Doe") } + it { should have_content("DOE, John") } it { should have_content("Date of birth") } it { should have_content("1 January 2000") } diff --git a/spec/components/app_outcome_banner_component_spec.rb b/spec/components/app_outcome_banner_component_spec.rb index e0fc343cf..7b19e3046 100644 --- a/spec/components/app_outcome_banner_component_spec.rb +++ b/spec/components/app_outcome_banner_component_spec.rb @@ -33,7 +33,7 @@ it { should have_css(".app-card--red") } it { should have_css(".nhsuk-card__heading", text: "Could not vaccinate") } - it { should have_text("Alya Merton has already had the vaccine") } + it { should have_text("MERTON, Alya has already had the vaccine") } it { should have_text("Location\n#{location_name}") } end @@ -44,7 +44,7 @@ it { should have_css(".app-card--red") } it { should have_css(".nhsuk-card__heading", text: "Could not vaccinate") } - it { should have_text("Reason\nAlya Merton has already had the vaccine") } + it { should have_text("Reason\nMERTON, Alya has already had the vaccine") } end context "not triaged, not possible to vaccinate" do @@ -54,7 +54,7 @@ it { should have_css(".app-card--red") } it { should have_css(".nhsuk-card__heading", text: "Could not vaccinate") } - it { should have_text("Reason\nAlya Merton has already had the vaccine") } + it { should have_text("Reason\nMERTON, Alya has already had the vaccine") } end context "state is vaccinated" do diff --git a/spec/components/app_patient_summary_component_spec.rb b/spec/components/app_patient_summary_component_spec.rb index fc291611b..9ee31ce9a 100644 --- a/spec/components/app_patient_summary_component_spec.rb +++ b/spec/components/app_patient_summary_component_spec.rb @@ -41,10 +41,10 @@ it { should have_content("123\u00A0\u200D456\u00A0\u200D7890") } it { should have_content("Full name") } - it { should have_content("John Doe") } + it { should have_content("DOE, John") } it { should have_content("Known as") } - it { should have_content("Johnny Doe") } + it { should have_content("DOE, Johnny") } it { should have_content("Date of birth") } it { should have_content("1 January 2000") } @@ -82,7 +82,7 @@ context "with pending changes" do let(:component) { described_class.new(patient.with_pending_changes) } - it { should have_css(".app-highlight", text: "Jane Doe") } + it { should have_css(".app-highlight", text: "DOE, Jane") } it { should have_css(".app-highlight", text: "1 January 2001") } it { should have_css(".app-highlight", text: "SW1A 2AA") } it { should_not have_css(".app-highlight", text: "Male") } diff --git a/spec/components/app_patient_table_component_spec.rb b/spec/components/app_patient_table_component_spec.rb index 92736d84e..840cef14b 100644 --- a/spec/components/app_patient_table_component_spec.rb +++ b/spec/components/app_patient_table_component_spec.rb @@ -50,7 +50,7 @@ ".nhsuk-table__body .nhsuk-table__row", count: 10 ) - expect(rendered).to have_css(".nhsuk-table__cell", text: "John Smith") + expect(rendered).to have_css(".nhsuk-table__cell", text: "SMITH, John") expect(rendered).to have_css( ".nhsuk-table__cell", text: "999\u00A0\u200D999\u00A0\u200D9999" @@ -64,14 +64,14 @@ end it "renders links" do - expect(rendered).to have_link("John Smith") + expect(rendered).to have_link("SMITH, John") end context "with a patient not in the cohort" do before { patients.first.update!(organisation: nil) } it "doesn't render a link" do - expect(rendered).not_to have_link("John Smith") + expect(rendered).not_to have_link("SMITH, John") expect(rendered).to have_content("Child has moved out of the area") end end diff --git a/spec/components/app_timestamped_entry_component_spec.rb b/spec/components/app_timestamped_entry_component_spec.rb index 02947d3a5..931ad14b8 100644 --- a/spec/components/app_timestamped_entry_component_spec.rb +++ b/spec/components/app_timestamped_entry_component_spec.rb @@ -33,6 +33,6 @@ ) end - it { should have_link("Test User", href: "mailto:test@example.com") } + it { should have_link("USER, Test", href: "mailto:test@example.com") } end end diff --git a/spec/components/app_triage_notes_component_spec.rb b/spec/components/app_triage_notes_component_spec.rb index de842188a..82fc7da87 100644 --- a/spec/components/app_triage_notes_component_spec.rb +++ b/spec/components/app_triage_notes_component_spec.rb @@ -40,7 +40,7 @@ it { should have_css("h3", text: "Triaged decision: Safe to vaccinate") } it { should have_css("p", text: "Some notes") } it { should have_css("p", text: "4 December 2023 at 10:04am") } - it { should have_css("p", text: "Joe Gear") } + it { should have_css("p", text: "GEAR, Joe") } it { should_not have_css("hr") } end @@ -84,7 +84,7 @@ it { should have_css("h3", text: "Completed pre-screening checks") } it { should have_css("p", text: "Some notes") } it { should have_css("p", text: "4 December 2023 at 10:04am") } - it { should have_css("p", text: "Joe Gear") } + it { should have_css("p", text: "GEAR, Joe") } it { should_not have_css("hr") } end end diff --git a/spec/components/app_vaccination_record_summary_component_spec.rb b/spec/components/app_vaccination_record_summary_component_spec.rb index 78b60e189..38d32b09f 100644 --- a/spec/components/app_vaccination_record_summary_component_spec.rb +++ b/spec/components/app_vaccination_record_summary_component_spec.rb @@ -215,10 +215,17 @@ describe "vaccinator row" do context "when the user is present" do + let(:vaccination_record) do + create( + :vaccination_record, + performed_by: create(:user, given_name: "Test", family_name: "Nurse") + ) + end + it do expect(rendered).to have_css( ".nhsuk-summary-list__row", - text: "Vaccinator\nTest User" + text: "Vaccinator\nNURSE, Test" ) end end @@ -229,14 +236,14 @@ :vaccination_record, performed_by: nil, performed_by_given_name: "Test", - performed_by_family_name: "User" + performed_by_family_name: "Nurse" ) end it do expect(rendered).to have_css( ".nhsuk-summary-list__row", - text: "Vaccinator\nTest User" + text: "Vaccinator\nNURSE, Test" ) end end diff --git a/spec/components/app_vaccination_record_table_component_spec.rb b/spec/components/app_vaccination_record_table_component_spec.rb index 9f74b3016..35cb28f56 100644 --- a/spec/components/app_vaccination_record_table_component_spec.rb +++ b/spec/components/app_vaccination_record_table_component_spec.rb @@ -65,8 +65,8 @@ ".nhsuk-table__body .nhsuk-table__row", count: 10 ) - expect(rendered).to have_css(".nhsuk-table__cell", text: "John Smith") - expect(rendered).to have_link("John Smith") + expect(rendered).to have_css(".nhsuk-table__cell", text: "SMITH, John") + expect(rendered).to have_link("SMITH, John") expect(rendered).to have_css( ".nhsuk-table__cell", text: "999\u00A0\u200D999\u00A0\u200D9999" diff --git a/spec/controllers/concerns/patient_sorting_concern_spec.rb b/spec/controllers/concerns/patient_sorting_concern_spec.rb index 0d5125345..0b4f9ecb9 100644 --- a/spec/controllers/concerns/patient_sorting_concern_spec.rb +++ b/spec/controllers/concerns/patient_sorting_concern_spec.rb @@ -17,7 +17,7 @@ def initialize(params) let(:alex) do create( :patient, - given_name: "Alex", + family_name: "Alex", year_group: 8, address_postcode: "SW1A 1AA" ) @@ -25,13 +25,18 @@ def initialize(params) let(:blair) do create( :patient, - given_name: "Blair", + family_name: "Blair", year_group: 9, address_postcode: "SW2A 1AA" ) end let(:casey) do - create(:patient, given_name: "Casey", year_group: 10, address_postcode: nil) + create( + :patient, + family_name: "Casey", + year_group: 10, + address_postcode: nil + ) end let(:programme) { create(:programme) } @@ -51,7 +56,7 @@ def initialize(params) it "sorts patient sessions by name in ascending order" do controller.sort_patients!(patient_sessions, programme:) - expect(patient_sessions.map(&:patient).map(&:given_name)).to eq( + expect(patient_sessions.map(&:patient).map(&:family_name)).to eq( %w[Alex Blair Casey] ) end @@ -62,7 +67,7 @@ def initialize(params) it "sorts patient sessions by date of birth in descending order" do controller.sort_patients!(patient_sessions, programme:) - expect(patient_sessions.map(&:patient).map(&:given_name)).to eq( + expect(patient_sessions.map(&:patient).map(&:family_name)).to eq( %w[Alex Blair Casey] ) end @@ -84,7 +89,7 @@ def initialize(params) it "sorts patient sessions by name in ascending order" do controller.sort_patients!(patient_sessions, programme:) - expect(patient_sessions.map(&:patient).map(&:given_name)).to eq( + expect(patient_sessions.map(&:patient).map(&:family_name)).to eq( %w[Blair Alex Casey] ) end @@ -94,7 +99,7 @@ def initialize(params) it "they are treated as though they have no postcode" do controller.sort_patients!(patient_sessions, programme:) - expect(patient_sessions.map(&:patient).map(&:given_name)).to eq( + expect(patient_sessions.map(&:patient).map(&:family_name)).to eq( %w[Alex Casey Blair] ) end @@ -106,7 +111,7 @@ def initialize(params) it "does not change the order of patient sessions" do controller.sort_patients!(patient_sessions, programme:) - expect(patient_sessions.map(&:patient).map(&:given_name)).to eq( + expect(patient_sessions.map(&:patient).map(&:family_name)).to eq( %w[Alex Blair Casey] ) end @@ -120,7 +125,7 @@ def initialize(params) it "filters patient sessions by patient name" do controller.filter_patients!(patient_sessions, programme:) expect(patient_sessions.size).to eq(1) - expect(patient_sessions.first.patient.given_name).to eq("Alex") + expect(patient_sessions.first.patient.family_name).to eq("Alex") end end @@ -130,7 +135,7 @@ def initialize(params) it "filters patient sessions by date of birth" do controller.filter_patients!(patient_sessions, programme:) expect(patient_sessions.size).to eq(1) - expect(patient_sessions.first.patient.given_name).to eq("Blair") + expect(patient_sessions.first.patient.family_name).to eq("Blair") end context "when a patient is restricted" do @@ -149,7 +154,7 @@ def initialize(params) it "filters patient sessions by date of birth" do controller.filter_patients!(patient_sessions, programme:) expect(patient_sessions.size).to eq(1) - expect(patient_sessions.first.patient.given_name).to eq("Blair") + expect(patient_sessions.first.patient.family_name).to eq("Blair") end end @@ -159,7 +164,7 @@ def initialize(params) it "filters patient sessions by both name and date of birth" do controller.filter_patients!(patient_sessions, programme:) expect(patient_sessions.size).to eq(1) - expect(patient_sessions.first.patient.given_name).to eq("Alex") + expect(patient_sessions.first.patient.family_name).to eq("Alex") end end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 2c06d6566..9b1d7678a 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -62,8 +62,9 @@ sequence(:email) { |n| "nurse-#{n}@example.com" } fallback_role { :nurse } - sequence(:family_name) { |n| "User #{n}" } given_name { "Test" } + family_name { "User" } + organisations { [organisation] } # Don't set a password as this interferes with CIS2. diff --git a/spec/features/e2e_journey_spec.rb b/spec/features/e2e_journey_spec.rb index 43f932c5b..58a05cb2c 100644 --- a/spec/features/e2e_journey_spec.rb +++ b/spec/features/e2e_journey_spec.rb @@ -165,11 +165,11 @@ def when_i_look_at_children_that_need_consent_responses def then_i_see_the_children_from_the_cohort click_link "No response" - expect(page).to have_content("Bobby Tables") + expect(page).to have_content("TABLES, Bobby") end def when_i_click_on_the_child_we_registered - click_link "Bobby Tables" + click_link "TABLES, Bobby" end def then_i_see_the_childs_details_including_the_updated_nhs_number @@ -207,7 +207,7 @@ def when_i_register_verbal_consent_and_triage click_button "Confirm" - click_link "Bobby Tables" + click_link "TABLES, Bobby" end def then_i_should_see_that_the_patient_is_ready_for_vaccination @@ -231,7 +231,7 @@ def when_i_click_on_the_vaccination_section end def and_i_record_the_successful_vaccination - click_link "Bobby Tables" + click_link "TABLES, Bobby" expect(page).to have_content("Update attendance") diff --git a/spec/features/edit_vaccination_record_spec.rb b/spec/features/edit_vaccination_record_spec.rb index 131acc0ae..27c8ea1c5 100644 --- a/spec/features/edit_vaccination_record_spec.rb +++ b/spec/features/edit_vaccination_record_spec.rb @@ -344,18 +344,18 @@ def when_i_go_to_the_vaccination_records_page def then_i_should_see_the_vaccination_records expect(page).to have_content("1 vaccination record") - expect(page).to have_content("John Smith") + expect(page).to have_content("SMITH, John") end def when_i_click_on_the_vaccination_record - click_on "John Smith" + click_on "SMITH, John" end alias_method :and_i_click_on_the_vaccination_record, :when_i_click_on_the_vaccination_record def then_i_should_see_the_vaccination_record - expect(page).to have_content("Full nameJohn Smith") + expect(page).to have_content("Full nameSMITH, John") end def when_i_click_on_edit_vaccination_record diff --git a/spec/features/import_child_records_slow_spec.rb b/spec/features/import_child_records_slow_spec.rb index eda7b2494..50af375d8 100644 --- a/spec/features/import_child_records_slow_spec.rb +++ b/spec/features/import_child_records_slow_spec.rb @@ -63,18 +63,18 @@ def when_i_upload_a_valid_file def and_i_should_see_the_patients expect(page).to have_content("1000 children") expect(page).to have_content("Full nameNHS numberDate of birthPostcode") - expect(page).to have_content("Roxanna Mayer") + expect(page).to have_content("MAYER, Roxanna") end def and_i_should_see_the_patients_for_page_two expect(page).to have_content("1000 children") expect(page).to have_content("Full nameNHS numberDate of birthPostcode") - expect(page).to have_content("Elijah Christiansen") + expect(page).to have_content("CHRISTIANSEN, Elijah") end def then_i_should_see_the_upload expect(page).to have_content("Imported on") - expect(page).to have_content("Imported byTest User") + expect(page).to have_content("Imported byUSER, Test") end def then_i_should_see_the_imports_page_with_the_processing_flash diff --git a/spec/features/import_child_records_spec.rb b/spec/features/import_child_records_spec.rb index 525cb0bfa..ceb25e750 100644 --- a/spec/features/import_child_records_spec.rb +++ b/spec/features/import_child_records_spec.rb @@ -93,7 +93,7 @@ def and_i_upload_a_valid_file def then_i_should_see_the_patients expect(page).to have_content("Full nameNHS numberDate of birthPostcode") - expect(page).to have_content("Jimmy Smith") + expect(page).to have_content("SMITH, Jimmy") expect(page).to have_content(/NHS number.*123.*456.*7890/) expect(page).to have_content("Date of birth 1 January 2010") expect(page).to have_content("Postcode SW1A 1AA") @@ -106,7 +106,7 @@ def when_i_click_on_upload_records def then_i_should_see_the_upload expect(page).to have_content("Imported on") - expect(page).to have_content("Imported byTest User") + expect(page).to have_content("Imported byUSER, Test") end def when_i_click_on_the_imports_page @@ -131,7 +131,7 @@ def when_i_click_on_the_cohort def then_i_should_see_the_children expect(page).to have_content("2 children") expect(page).to have_content("Full nameNHS numberDate of birthPostcode") - expect(page).to have_content("Full name Jimmy Smith") + expect(page).to have_content("Full name SMITH, Jimmy") expect(page).to have_content(/NHS number.*123.*456.*7891/) expect(page).to have_content("Date of birth 2 January 2010") expect(page).to have_content("Postcode SW1A 1AA") diff --git a/spec/features/import_child_records_with_duplicates_spec.rb b/spec/features/import_child_records_with_duplicates_spec.rb index 58bb24a66..8f8457afd 100644 --- a/spec/features/import_child_records_with_duplicates_spec.rb +++ b/spec/features/import_child_records_with_duplicates_spec.rb @@ -162,7 +162,7 @@ def then_i_should_see_a_success_message end def when_i_review_the_first_duplicate_record - click_on "Review Jennifer Clarke" + click_on "Review CLARKE, Jennifer" end def then_i_should_see_the_first_duplicate_record @@ -174,8 +174,8 @@ def then_i_should_see_the_first_duplicate_record def then_i_should_see_the_second_duplicate_record expect(page).to have_content("This record needs reviewing") - expect(page).to have_content("Full nameJames Smith") - expect(page).to have_content("Full nameJimmy Smith") + expect(page).to have_content("Full nameSMITH, James") + expect(page).to have_content("Full nameSMITH, Jimmy") expect(page).to have_content("Address10 Downing StreetLondonSW11 1AA") expect(page).to have_content("Address10 Downing StreetLondonSW1A 1AA") end @@ -185,7 +185,7 @@ def then_i_should_see_a_validation_error end def when_i_review_the_second_duplicate_record - click_on "Review James Smith" + click_on "Review SMITH, James" end def and_the_first_duplicate_record_should_be_persisted @@ -228,12 +228,12 @@ def and_a_new_patient_record_should_be_created end def when_i_review_the_third_duplicate_record - click_on "Review Mark Doe" + click_on "Review DOE, Mark" end def then_i_should_see_the_third_duplicate_record expect(page).to have_content("This record needs reviewing") - expect(page).to have_content("Full nameMark Doe") + expect(page).to have_content("Full nameDOE, Mark") expect(page).to have_content("Date of birth3 January 2010 (aged 14)") expect(page).to have_content("Date of birth3 March 2013 (aged 11)") expect(page).to have_content("Year groupYear 10 (") diff --git a/spec/features/import_class_lists_spec.rb b/spec/features/import_class_lists_spec.rb index 84f9cfb36..6f8ff574f 100644 --- a/spec/features/import_class_lists_spec.rb +++ b/spec/features/import_class_lists_spec.rb @@ -93,7 +93,7 @@ def and_i_upload_a_valid_file def then_i_should_see_the_patients expect(page).to have_content("Full nameNHS numberDate of birthPostcode") - expect(page).to have_content("Jimmy Smith") + expect(page).to have_content("SMITH, Jimmy") expect(page).to have_content(/NHS number.*123.*456.*7890/) expect(page).to have_content("Date of birth 1 January 2010") expect(page).to have_content("Postcode SW1A 1AA") @@ -106,7 +106,7 @@ def when_i_click_on_upload_records def then_i_should_see_the_upload expect(page).to have_content("Imported on") - expect(page).to have_content("Imported byTest User") + expect(page).to have_content("Imported byUSER, Test") expect(page).to have_content( "Year groupsYear 8, Year 9, Year 10, and Year 11" ) @@ -129,7 +129,7 @@ def then_i_should_see_the_children_added_to_the_session def then_i_should_see_the_children expect(page).to have_content("4 children") expect(page).to have_content("Full nameNHS numberDate of birthPostcode") - expect(page).to have_content("Full name Jimmy Smith") + expect(page).to have_content("Full name SMITH, Jimmy") expect(page).to have_content(/NHS number.*123.*456.*7890/) expect(page).to have_content("Date of birth 1 January 2010") expect(page).to have_content("Postcode SW1A 1AA") diff --git a/spec/features/import_class_lists_with_duplicates_spec.rb b/spec/features/import_class_lists_with_duplicates_spec.rb index 9e38faee1..b729c1e96 100644 --- a/spec/features/import_class_lists_with_duplicates_spec.rb +++ b/spec/features/import_class_lists_with_duplicates_spec.rb @@ -141,7 +141,7 @@ def then_i_should_see_the_import_page_with_duplicate_records end def when_i_review_the_first_duplicate_record - click_on "Review Jimmy Smith" + click_on "Review SMITH, Jimmy" end def then_i_should_see_the_first_duplicate_record @@ -183,13 +183,13 @@ def and_the_first_record_should_be_updated end def when_i_review_the_second_duplicate_record - click_on "Review Sarah Jones" + click_on "Review JONES, Sarah" end def then_i_should_see_the_second_duplicate_record expect(page).to have_content("This record needs reviewing") - expect(page).to have_content("Full nameSara Jones") - expect(page).to have_content("Full nameSarah Jones") + expect(page).to have_content("Full nameJONES, Sara") + expect(page).to have_content("Full nameJONES, Sarah") end def and_the_second_record_should_not_be_updated @@ -199,12 +199,12 @@ def and_the_second_record_should_not_be_updated end def when_i_review_the_third_duplicate_record - click_on "Review Jenny Block" + click_on "Review BLOCK, Jenny" end def then_i_should_see_the_third_duplicate_record expect(page).to have_content("This record needs reviewing") - expect(page).to have_content("Full nameJenny Block") + expect(page).to have_content("Full nameBLOCK, Jenny") end def and_the_third_record_should_not_be_updated diff --git a/spec/features/import_vaccination_records_spec.rb b/spec/features/import_vaccination_records_spec.rb index 82f627f09..9617323fc 100644 --- a/spec/features/import_vaccination_records_spec.rb +++ b/spec/features/import_vaccination_records_spec.rb @@ -142,7 +142,7 @@ def then_i_should_see_the_vaccination_records expect(page).to have_content( "Full nameNHS numberDate of birthVaccination date" ) - expect(page).to have_content("Full name Chyna Pickle") + expect(page).to have_content("Full name PICKLE, Chyna") expect(page).to have_content(/NHS number.*742.*018.*0008/) expect(page).to have_content("Date of birth 12 September 2010") expect(page).to have_content("Vaccination date 14 May 2024") @@ -161,11 +161,11 @@ def and_i_click_on_upload_records def then_i_should_see_the_upload expect(page).to have_content("Imported on") - expect(page).to have_content("Imported byTest User") + expect(page).to have_content("Imported byUSER, Test") end def when_i_click_on_a_vaccination_record - click_on "Chyna Pickle" + click_on "PICKLE, Chyna" end def when_i_click_on_cohorts @@ -186,9 +186,9 @@ def when_i_click_on_vaccination_records end def then_i_should_see_the_vaccination_record - expect(page).to have_content("Chyna Pickle") + expect(page).to have_content("PICKLE, Chyna") expect(page).to have_content("Child") - expect(page).to have_content("Full nameChyna Pickle") + expect(page).to have_content("Full namePICKLE, Chyna") expect(page).to have_content("Vaccination details") expect(page).to have_content("OutcomeVaccinated") end diff --git a/spec/features/import_vaccination_records_with_duplicates_spec.rb b/spec/features/import_vaccination_records_with_duplicates_spec.rb index f47b717b3..e143ff35c 100644 --- a/spec/features/import_vaccination_records_with_duplicates_spec.rb +++ b/spec/features/import_vaccination_records_with_duplicates_spec.rb @@ -181,7 +181,7 @@ def then_i_should_see_a_success_message end def when_i_review_the_first_duplicate_record - click_on "Review Caden Attwater" + click_on "Review ATTWATER, Caden" end def then_i_should_see_the_first_duplicate_record @@ -222,7 +222,7 @@ def then_i_should_see_a_validation_error end def when_i_review_the_second_duplicate_record - click_on "Review Joanna Hamilton" + click_on "Review HAMILTON, Joanna" end def and_the_duplicate_record_should_be_persisted diff --git a/spec/features/manage_children_spec.rb b/spec/features/manage_children_spec.rb index e5f4c884d..dd270fea8 100644 --- a/spec/features/manage_children_spec.rb +++ b/spec/features/manage_children_spec.rb @@ -208,14 +208,14 @@ def then_i_see_the_children end def when_i_click_on_a_child - click_on "John Smith" + click_on "SMITH, John" end alias_method :and_i_click_on_a_child, :when_i_click_on_a_child def then_i_see_the_child expect(page).to have_title("JS") - expect(page).to have_content("John Smith") + expect(page).to have_content("SMITH, John") expect(page).to have_content("Cohorts") expect(page).to have_content("Sessions") end @@ -235,7 +235,7 @@ def when_i_click_on_edit_child_record def then_i_see_the_edit_child_record_page expect(page).to have_title("Edit child record") - expect(page).to have_content("John Smith") + expect(page).to have_content("SMITH, John") expect(page).to have_content("Record details") end @@ -276,7 +276,7 @@ def and_i_see_the_blank_nhs_number def then_i_see_the_merge_record_page expect(page).to have_content("Do you want to merge this record?") - expect(page).to have_content("Jane Doe") + expect(page).to have_content("DOE, Jane") end def when_i_click_on_merge_records @@ -285,7 +285,7 @@ def when_i_click_on_merge_records def then_i_see_the_merged_edit_child_record_page expect(page).to have_title("Edit child record") - expect(page).to have_content("Jane Doe") + expect(page).to have_content("DOE, Jane") end def and_i_see_the_cohort diff --git a/spec/features/parental_consent_clinic_spec.rb b/spec/features/parental_consent_clinic_spec.rb index 98a0861ac..9d7641958 100644 --- a/spec/features/parental_consent_clinic_spec.rb +++ b/spec/features/parental_consent_clinic_spec.rb @@ -219,7 +219,9 @@ def and_i_answer_no_to_all_the_medical_questions def then_i_can_check_my_answers expect(page).to have_content("Check and confirm") - expect(page).to have_content("Child’s name#{@child.full_name}") + expect(page).to have_content( + "Child’s name#{@child.full_name(context: :parents)}" + ) end def when_i_submit_the_consent_form diff --git a/spec/features/parental_consent_create_patient_spec.rb b/spec/features/parental_consent_create_patient_spec.rb index 24d9cc318..7125a6eb4 100644 --- a/spec/features/parental_consent_create_patient_spec.rb +++ b/spec/features/parental_consent_create_patient_spec.rb @@ -133,7 +133,7 @@ def and_i_submit_the_consent_form def then_i_see_the_consent_confirmation_page expect(page).to have_content( - "#{@child.full_name} is due to get the HPV vaccination at school" + "#{@child.full_name(context: :parents)} is due to get the HPV vaccination at school" ) end diff --git a/spec/features/parental_consent_doubles_spec.rb b/spec/features/parental_consent_doubles_spec.rb index a007ab6ec..3dfe691c9 100644 --- a/spec/features/parental_consent_doubles_spec.rb +++ b/spec/features/parental_consent_doubles_spec.rb @@ -154,7 +154,9 @@ def and_i_answer_no_to_all_the_medical_questions(only_menacwy:) def then_i_can_check_my_answers expect(page).to have_content("Check and confirm") - expect(page).to have_content("Child’s name#{@child.full_name}") + expect(page).to have_content( + "Child’s name#{@child.full_name(context: :parents)}" + ) end def then_i_see_the_consent_page diff --git a/spec/features/parental_consent_home_educated_spec.rb b/spec/features/parental_consent_home_educated_spec.rb index 7d8567db2..2c9dad2bd 100644 --- a/spec/features/parental_consent_home_educated_spec.rb +++ b/spec/features/parental_consent_home_educated_spec.rb @@ -117,7 +117,9 @@ def and_i_answer_no_to_all_the_medical_questions def then_i_can_check_my_answers expect(page).to have_content("Check and confirm") - expect(page).to have_content("Child’s name#{@child.full_name}") + expect(page).to have_content( + "Child’s name#{@child.full_name(context: :parents)}" + ) expect(page).to have_content("SchoolHome-schooled") end end diff --git a/spec/features/parental_consent_refused_spec.rb b/spec/features/parental_consent_refused_spec.rb index 00ca73f4a..371bebed7 100644 --- a/spec/features/parental_consent_refused_spec.rb +++ b/spec/features/parental_consent_refused_spec.rb @@ -112,7 +112,7 @@ def when_i_confirm_my_answers def then_i_see_the_confirmation_page expect(page).to have_content( - "You’ve told us that you do not want #{@child.full_name} to get the HPV vaccination at school" + "You’ve told us that you do not want #{@child.full_name(context: :parents)} to get the HPV vaccination at school" ) end diff --git a/spec/features/parental_consent_school_session_completed_spec.rb b/spec/features/parental_consent_school_session_completed_spec.rb index 53c031f8a..a0b5b097f 100644 --- a/spec/features/parental_consent_school_session_completed_spec.rb +++ b/spec/features/parental_consent_school_session_completed_spec.rb @@ -131,7 +131,9 @@ def and_i_answer_no_to_all_the_medical_questions def then_i_can_check_my_answers expect(page).to have_content("Check and confirm") - expect(page).to have_content("Child’s name#{@child.full_name}") + expect(page).to have_content( + "Child’s name#{@child.full_name(context: :parents)}" + ) end def when_i_submit_the_consent_form @@ -140,7 +142,7 @@ def when_i_submit_the_consent_form def then_i_get_a_confirmation_email expect(page).to have_content( - "#{@child.full_name} is due to get the HPV vaccination at school" + "#{@child.full_name(context: :parents)} is due to get the HPV vaccination at school" ) expect_email_to("jane@example.com", :consent_confirmation_clinic) diff --git a/spec/features/parental_consent_send_request_spec.rb b/spec/features/parental_consent_send_request_spec.rb index 95404d173..3ff42aa72 100644 --- a/spec/features/parental_consent_send_request_spec.rb +++ b/spec/features/parental_consent_send_request_spec.rb @@ -80,7 +80,7 @@ def and_an_activity_log_entry_is_visible_for_the_email click_on "Activity log" expect(page).to have_content( "Consent clinic request sent\n#{@parent.email}\n" \ - "HPV 1 January 2024 at 12:00am · Test User" + "HPV 1 January 2024 at 12:00am · USER, Test" ) end @@ -88,7 +88,7 @@ def and_an_activity_log_entry_is_visible_for_the_text click_on "Activity log" expect(page).to have_content( "Consent clinic request sent\n#{@parent.phone}\n" \ - "HPV 1 January 2024 at 12:00am · Test User" + "HPV 1 January 2024 at 12:00am · USER, Test" ) end end diff --git a/spec/features/parental_consent_spec.rb b/spec/features/parental_consent_spec.rb index ca94b240a..118292f11 100644 --- a/spec/features/parental_consent_spec.rb +++ b/spec/features/parental_consent_spec.rb @@ -120,7 +120,9 @@ def and_i_answer_no_to_all_the_medical_questions def then_i_can_check_my_answers expect(page).to have_content("Check and confirm") - expect(page).to have_content("Child’s name#{@child.full_name}") + expect(page).to have_content( + "Child’s name#{@child.full_name(context: :parents)}" + ) end def when_i_submit_the_consent_form diff --git a/spec/features/patient_search_spec.rb b/spec/features/patient_search_spec.rb index 31d71c6f9..6d3691612 100644 --- a/spec/features/patient_search_spec.rb +++ b/spec/features/patient_search_spec.rb @@ -55,12 +55,12 @@ def when_i_visit_the_patients_page end def then_i_see_all_patients - expect(page).to have_content "Aaron Smith" - expect(page).to have_content "Aardvark Jones" - expect(page).to have_content "Casey Brown" - expect(page).to have_content "Cassidy Wilson" - expect(page).to have_content "Bob Taylor" - expect(page).to have_content "Salvor Hardin" + expect(page).to have_content("SMITH, Aaron") + expect(page).to have_content("JONES, Aardvark") + expect(page).to have_content("BROWN, Casey") + expect(page).to have_content("WILSON, Cassidy") + expect(page).to have_content("TAYLOR, Bob") + expect(page).to have_content("HARDIN, Salvor") end def when_i_search_for_cas @@ -70,12 +70,12 @@ def when_i_search_for_cas end def then_i_see_patients_matching_cas - expect(page).to have_content "Casey Brown" - expect(page).to have_content "Cassidy Wilson" - expect(page).not_to have_content "Aaron Smith" - expect(page).not_to have_content "Aardvark Jones" - expect(page).not_to have_content "Bob Taylor" - expect(page).not_to have_content "Salvor Hardin" + expect(page).to have_content("BROWN, Casey") + expect(page).to have_content("WILSON, Cassidy") + expect(page).not_to have_content("SMITH, Aaron") + expect(page).not_to have_content("JONES, Aardvark") + expect(page).not_to have_content("TAYLOR, Bob") + expect(page).not_to have_content("HARDIN, Salvor") end def and_i_see_the_search_count @@ -93,12 +93,12 @@ def when_i_search_for_a end def then_i_see_patients_starting_with_a - expect(page).to have_content "Aaron Smith" - expect(page).to have_content "Aardvark Jones" - expect(page).not_to have_content "Bob Taylor" - expect(page).not_to have_content "Casey Brown" - expect(page).not_to have_content "Cassidy Wilson" - expect(page).not_to have_content "Salvor Hardin" + expect(page).to have_content("SMITH, Aaron") + expect(page).to have_content("JONES, Aardvark") + expect(page).not_to have_content("TAYLOR, Bob") + expect(page).not_to have_content("BROWN, Casey") + expect(page).not_to have_content("WILSON, Cassidy") + expect(page).not_to have_content("HARDIN, Salvor") end def when_i_search_for_aa @@ -107,12 +107,12 @@ def when_i_search_for_aa end def then_i_see_patients_starting_with_aa - expect(page).to have_content "Aaron Smith" - expect(page).to have_content "Aardvark Jones" - expect(page).not_to have_content "Bob Taylor" - expect(page).not_to have_content "Casey Brown" - expect(page).not_to have_content "Cassidy Wilson" - expect(page).not_to have_content "Salvor Hardin" + expect(page).to have_content("SMITH, Aaron") + expect(page).to have_content("JONES, Aardvark") + expect(page).not_to have_content("TAYLOR, Bob") + expect(page).not_to have_content("BROWN, Casey") + expect(page).not_to have_content("WILSON, Cassidy") + expect(page).not_to have_content("HARDIN, Salvor") end def when_i_search_for_patients_without_nhs_numbers @@ -122,11 +122,11 @@ def when_i_search_for_patients_without_nhs_numbers end def then_i_see_patients_without_nhs_numbers - expect(page).not_to have_content "Aaron Smith" - expect(page).not_to have_content "Aardvark Jones" - expect(page).not_to have_content "Bob Taylor" - expect(page).not_to have_content "Casey Brown" - expect(page).not_to have_content "Cassidy Wilson" - expect(page).to have_content "Salvor Hardin" + expect(page).not_to have_content("SMITH, Aaron") + expect(page).not_to have_content("JONES, Aardvark") + expect(page).not_to have_content("TAYLOR, Bob") + expect(page).not_to have_content("BROWN, Casey") + expect(page).not_to have_content("WILSON, Cassidy") + expect(page).to have_content("HARDIN, Salvor") end end diff --git a/spec/features/td_ipv_already_had_spec.rb b/spec/features/td_ipv_already_had_spec.rb index fc0773780..f3b11a4c1 100644 --- a/spec/features/td_ipv_already_had_spec.rb +++ b/spec/features/td_ipv_already_had_spec.rb @@ -79,7 +79,7 @@ def when_i_click_on_consent end def and_i_click_on_the_patient - click_on "Chyna Pickle" + click_on "PICKLE, Chyna" end def then_i_see_the_patient_needs_consent diff --git a/spec/features/triage_partially_vaccinated_spec.rb b/spec/features/triage_partially_vaccinated_spec.rb index 175dad46c..2714372c9 100644 --- a/spec/features/triage_partially_vaccinated_spec.rb +++ b/spec/features/triage_partially_vaccinated_spec.rb @@ -101,7 +101,7 @@ def when_i_click_on_triage end def and_i_click_on_the_patient - click_on "Chyna Pickle" + click_on "PICKLE, Chyna" end def then_i_see_the_patient_needs_triage diff --git a/spec/features/triage_then_parental_consent_refused_spec.rb b/spec/features/triage_then_parental_consent_refused_spec.rb index 15b446e4a..0ee7bf95b 100644 --- a/spec/features/triage_then_parental_consent_refused_spec.rb +++ b/spec/features/triage_then_parental_consent_refused_spec.rb @@ -113,7 +113,8 @@ def and_i_refuse_consent def then_i_see_the_confirmation_page expect(page).to have_content( - "You’ve told us that you do not want #{@patient.full_name} to get the HPV vaccination at school" + "You’ve told us that you do not want #{@patient.full_name(context: :parents)} " \ + "to get the HPV vaccination at school" ) end diff --git a/spec/features/user_cis2_authentication_from_start_page_spec.rb b/spec/features/user_cis2_authentication_from_start_page_spec.rb index 406d48580..4ea26cf69 100644 --- a/spec/features/user_cis2_authentication_from_start_page_spec.rb +++ b/spec/features/user_cis2_authentication_from_start_page_spec.rb @@ -57,7 +57,7 @@ def then_i_see_the_dashboard end def and_i_am_logged_in - expect(page).to have_content "Nurse Test" + expect(page).to have_content("TEST, Nurse") expect(page).to have_button "Log out" end @@ -74,8 +74,8 @@ def then_i_am_on_the_start_page end def and_i_am_logged_out - expect(page).not_to have_content "Nurse Test" - expect(page).not_to have_button "Log out" + expect(page).not_to have_content("TEST, Nurse") + expect(page).not_to have_button("Log out") end def when_i_go_to_the_sessions_page diff --git a/spec/features/user_cis2_authentication_with_redirect_spec.rb b/spec/features/user_cis2_authentication_with_redirect_spec.rb index 6f28ae70e..6e6fe3048 100644 --- a/spec/features/user_cis2_authentication_with_redirect_spec.rb +++ b/spec/features/user_cis2_authentication_with_redirect_spec.rb @@ -40,14 +40,14 @@ def then_i_see_the_sessions_page end def and_i_am_logged_in - expect(page).to have_content "Nurse Test" - expect(page).to have_button "Log out" + expect(page).to have_content("TEST, Nurse") + expect(page).to have_button("Log out") end def then_i_see_the_organisation_not_found_error - expect( - page - ).to have_heading "Your organisation is not using this service yet" + expect(page).to have_heading( + "Your organisation is not using this service yet" + ) end def when_i_click_the_change_role_button diff --git a/spec/lib/reports/programme_vaccinations_exporter_spec.rb b/spec/lib/reports/programme_vaccinations_exporter_spec.rb index c7040bc29..5e73199b5 100644 --- a/spec/lib/reports/programme_vaccinations_exporter_spec.rb +++ b/spec/lib/reports/programme_vaccinations_exporter_spec.rb @@ -425,7 +425,7 @@ it "includes the information" do expect(rows.first.to_hash).to include( - "GILLICK_ASSESSED_BY" => "Test Nurse", + "GILLICK_ASSESSED_BY" => "NURSE, Test", "GILLICK_ASSESSMENT_DATE" => "2024-01-01", "GILLICK_ASSESSMENT_NOTES" => "Assessed as Gillick competent", "GILLICK_NOTIFY_PARENTS" => "", @@ -478,7 +478,7 @@ it "includes the information" do expect(rows.first.to_hash).to include( - "TRIAGED_BY" => "Test Nurse", + "TRIAGED_BY" => "NURSE, Test", "TRIAGE_DATE" => Date.current.strftime("%Y-%m-%d"), "TRIAGE_NOTES" => "Okay to vaccinate", "TRIAGE_STATUS" => "Ready to vaccinate" diff --git a/spec/models/class_import_spec.rb b/spec/models/class_import_spec.rb index 2a880fd4a..9924b61e2 100644 --- a/spec/models/class_import_spec.rb +++ b/spec/models/class_import_spec.rb @@ -169,7 +169,8 @@ expect(Patient.first).to have_attributes( nhs_number: "1234567890", date_of_birth: Date.new(2010, 1, 1), - full_name: "Jennifer Clarke", + given_name: "Jennifer", + family_name: "Clarke", school: location, address_line_1: "10 Downing Street", address_town: "London", @@ -188,7 +189,8 @@ expect(Patient.second).to have_attributes( nhs_number: "1234567891", date_of_birth: Date.new(2010, 1, 2), - full_name: "Jimmy Smith", + given_name: "Jimmy", + family_name: "Smith", school: location, address_line_1: "10 Downing Street", address_town: "London", @@ -209,7 +211,8 @@ expect(Patient.third).to have_attributes( nhs_number: "1234567892", date_of_birth: Date.new(2010, 1, 3), - full_name: "Mark Doe", + given_name: "Mark", + family_name: "Doe", school: location, address_line_1: "11 Downing Street", address_town: "London", @@ -237,7 +240,8 @@ expect(Patient.fourth).to have_attributes( nhs_number: nil, date_of_birth: Date.new(2010, 4, 9), - full_name: "Gae Thorne-Smith", + given_name: "Gae", + family_name: "Thorne-Smith", school: location, address_line_1: nil, address_town: nil, diff --git a/spec/models/cohort_import_spec.rb b/spec/models/cohort_import_spec.rb index c8f93bc30..eadc41001 100644 --- a/spec/models/cohort_import_spec.rb +++ b/spec/models/cohort_import_spec.rb @@ -184,7 +184,8 @@ expect(Patient.first).to have_attributes( nhs_number: "1234567890", date_of_birth: Date.new(2010, 1, 1), - full_name: "Jennifer Clarke", + given_name: "Jennifer", + family_name: "Clarke", school: location, address_line_1: "10 Downing Street", address_town: "London", @@ -196,7 +197,8 @@ expect(Patient.second).to have_attributes( nhs_number: "1234567891", date_of_birth: Date.new(2010, 1, 2), - full_name: "Jimmy Smith", + given_name: "Jimmy", + family_name: "Smith", school: location, address_line_1: "10 Downing Street", address_town: "London", @@ -216,7 +218,8 @@ expect(Patient.third).to have_attributes( nhs_number: nil, date_of_birth: Date.new(2010, 1, 3), - full_name: "Mark Doe", + given_name: "Mark", + family_name: "Doe", school: location, address_line_1: "11 Downing Street", address_town: "London", diff --git a/spec/models/consent_form_spec.rb b/spec/models/consent_form_spec.rb index e6b54013b..44bfc439d 100644 --- a/spec/models/consent_form_spec.rb +++ b/spec/models/consent_form_spec.rb @@ -314,7 +314,7 @@ it "returns the full name as a string" do consent_form = build(:consent_form, given_name: "John", family_name: "Doe") - expect(consent_form.full_name).to eq("John Doe") + expect(consent_form.full_name).to eq("DOE, John") end end diff --git a/spec/models/immunisation_import_row_spec.rb b/spec/models/immunisation_import_row_spec.rb index aba0db000..8777950df 100644 --- a/spec/models/immunisation_import_row_spec.rb +++ b/spec/models/immunisation_import_row_spec.rb @@ -1481,7 +1481,8 @@ it "has a vaccinator" do expect(vaccination_record.performed_by).to have_attributes( - full_name: "John Smith" + given_name: "John", + family_name: "Smith" ) end diff --git a/spec/models/vaccination_record_spec.rb b/spec/models/vaccination_record_spec.rb index 82b6b086e..ea3bee0ed 100644 --- a/spec/models/vaccination_record_spec.rb +++ b/spec/models/vaccination_record_spec.rb @@ -124,9 +124,9 @@ it do expect(performed_by).to have_attributes( - full_name: "John Smith", given_name: "John", - family_name: "Smith" + family_name: "Smith", + full_name: "SMITH, John" ) end end