diff --git a/spec/components/app_activity_log_component_spec.rb b/spec/components/app_activity_log_component_spec.rb index 51e1b8ffd..06f374dc9 100644 --- a/spec/components/app_activity_log_component_spec.rb +++ b/spec/components/app_activity_log_component_spec.rb @@ -30,6 +30,9 @@ before do create(:parent_relationship, :mother, parent: mum, patient:) create(:parent_relationship, :father, parent: dad, patient:) + + patient_session.strict_loading!(false) + patient_session.patient.strict_loading!(false) end shared_examples "card" do |title:, date:, notes: nil, by: nil| diff --git a/spec/components/app_consent_component_spec.rb b/spec/components/app_consent_component_spec.rb index e4d648843..b82ca41f1 100644 --- a/spec/components/app_consent_component_spec.rb +++ b/spec/components/app_consent_component_spec.rb @@ -10,6 +10,8 @@ let(:consent) { patient_session.consents.first } let(:relation) { consent.parent_relationship.label } + before { patient_session.strict_loading!(false) } + context "consent is not present" do let(:patient_session) { create(:patient_session) } diff --git a/spec/components/app_consent_status_component_spec.rb b/spec/components/app_consent_status_component_spec.rb index a7f9ea6e6..368f5032e 100644 --- a/spec/components/app_consent_status_component_spec.rb +++ b/spec/components/app_consent_status_component_spec.rb @@ -6,6 +6,8 @@ let(:component) { described_class.new(patient_session:) } let(:patient_session) { create(:patient_session) } + before { patient_session.strict_loading!(false) } + context "when consent is given" do let(:patient_session) do create(:patient_session, :consent_given_triage_needed) diff --git a/spec/components/app_outcome_banner_component_spec.rb b/spec/components/app_outcome_banner_component_spec.rb index 310e0856e..a1a9b2689 100644 --- a/spec/components/app_outcome_banner_component_spec.rb +++ b/spec/components/app_outcome_banner_component_spec.rb @@ -12,6 +12,8 @@ let(:location_name) { patient_session.session.location.name } let(:patient_name) { patient_session.patient.full_name } + before { patient_session.strict_loading!(false) } + prepend_before do patient_session.patient.update!(given_name: "Alya", family_name: "Merton") end diff --git a/spec/components/app_patient_page_component_spec.rb b/spec/components/app_patient_page_component_spec.rb index 8b5bc3810..2a02fb345 100644 --- a/spec/components/app_patient_page_component_spec.rb +++ b/spec/components/app_patient_page_component_spec.rb @@ -10,6 +10,8 @@ ).and_return("/session/patient/triage/new") # rubocop:enable RSpec/AnyInstance stub_authorization(allowed: true) + + patient_session.strict_loading!(false) end let(:programme) { create(:programme, :hpv) } diff --git a/spec/components/app_patient_summary_component_spec.rb b/spec/components/app_patient_summary_component_spec.rb index 03b687d72..d1ad185ce 100644 --- a/spec/components/app_patient_summary_component_spec.rb +++ b/spec/components/app_patient_summary_component_spec.rb @@ -32,7 +32,10 @@ ) end - before { create(:parent_relationship, :father, parent:, patient:) } + before do + create(:parent_relationship, :father, parent:, patient:) + patient.strict_loading!(false) + end it { should have_content("NHS number") } it { should have_content("123\u00A0\u200D456\u00A0\u200D7890") } diff --git a/spec/components/app_patient_vaccination_table_component_spec.rb b/spec/components/app_patient_vaccination_table_component_spec.rb index 88637849e..48f2e9947 100644 --- a/spec/components/app_patient_vaccination_table_component_spec.rb +++ b/spec/components/app_patient_vaccination_table_component_spec.rb @@ -7,6 +7,8 @@ let(:patient) { create(:patient) } + before { patient.strict_loading!(false) } + context "without a vaccination record" do let(:sessions) { [] } diff --git a/spec/components/app_programme_session_table_component_spec.rb b/spec/components/app_programme_session_table_component_spec.rb index e603f5a9e..8791522a7 100644 --- a/spec/components/app_programme_session_table_component_spec.rb +++ b/spec/components/app_programme_session_table_component_spec.rb @@ -6,13 +6,9 @@ let(:component) { described_class.new(sessions) } let(:programme) { create(:programme) } - let(:location) { create(:school, name: "Waterloo Road") } - let(:session) { create(:session, programme:, location:) } - let(:sessions) { [session] + create_list(:session, 2, programme:) } - let(:patient_session) { create(:patient_session, session:) } before do @@ -20,6 +16,8 @@ create(:consent, :given, programme:, patient: patient_session.patient) create(:vaccination_record, programme:, patient_session:) + + sessions.each { _1.strict_loading!(false) } end it { should have_content("3 sessions") } diff --git a/spec/components/app_session_patient_table_component_spec.rb b/spec/components/app_session_patient_table_component_spec.rb index 41fbbce78..5d1efe581 100644 --- a/spec/components/app_session_patient_table_component_spec.rb +++ b/spec/components/app_session_patient_table_component_spec.rb @@ -7,6 +7,8 @@ allow(component).to receive(:session_patient_path).and_return( "/session/patient/" ) + + patient_sessions.each { _1.strict_loading!(false) } end let(:section) { :consent } diff --git a/spec/components/app_simple_status_banner_component_spec.rb b/spec/components/app_simple_status_banner_component_spec.rb index 1c0127b43..aba9cdc84 100644 --- a/spec/components/app_simple_status_banner_component_spec.rb +++ b/spec/components/app_simple_status_banner_component_spec.rb @@ -8,6 +8,8 @@ "/session/patient/triage/new" ) stub_authorization(allowed: true) + + patient_session.strict_loading!(false) end let(:user) { create :user } diff --git a/spec/components/app_triage_notes_component_spec.rb b/spec/components/app_triage_notes_component_spec.rb index d91c211d7..5156fa2ae 100644 --- a/spec/components/app_triage_notes_component_spec.rb +++ b/spec/components/app_triage_notes_component_spec.rb @@ -9,6 +9,8 @@ let(:patient_session) { create(:patient_session, programme:) } let(:patient) { patient_session.patient } + before { patient_session.strict_loading!(false) } + context "triage notes are not present" do it "does not render" do expect(component.render?).to be(false) diff --git a/spec/components/app_vaccinate_form_component_spec.rb b/spec/components/app_vaccinate_form_component_spec.rb index 5b6195a9d..a2d0f7e87 100644 --- a/spec/components/app_vaccinate_form_component_spec.rb +++ b/spec/components/app_vaccinate_form_component_spec.rb @@ -29,6 +29,8 @@ ) end + before { patient_session.strict_loading!(false) } + it { should have_css(".nhsuk-card") } it "has the correct heading" do diff --git a/spec/controllers/concerns/patient_tabs_concern_spec.rb b/spec/controllers/concerns/patient_tabs_concern_spec.rb index 8ddcacd3a..4eb3d9160 100644 --- a/spec/controllers/concerns/patient_tabs_concern_spec.rb +++ b/spec/controllers/concerns/patient_tabs_concern_spec.rb @@ -61,6 +61,8 @@ ] end + before { patient_sessions.each { _1.strict_loading!(false) } } + describe "#group_patient_sessions_by_conditions" do it "groups patient sessions by conditions" do result = diff --git a/spec/controllers/concerns/triage_mailer_concern_spec.rb b/spec/controllers/concerns/triage_mailer_concern_spec.rb index ed308c293..4ebac3388 100644 --- a/spec/controllers/concerns/triage_mailer_concern_spec.rb +++ b/spec/controllers/concerns/triage_mailer_concern_spec.rb @@ -11,6 +11,8 @@ def initialize(current_user:) @current_user = current_user end end + + patient_session.strict_loading!(false) end let(:sample) { SampleClass.new(current_user:) } diff --git a/spec/controllers/concerns/vaccination_mailer_concern_spec.rb b/spec/controllers/concerns/vaccination_mailer_concern_spec.rb index 8a5974075..3af8464da 100644 --- a/spec/controllers/concerns/vaccination_mailer_concern_spec.rb +++ b/spec/controllers/concerns/vaccination_mailer_concern_spec.rb @@ -11,6 +11,9 @@ def initialize(current_user:) @current_user = current_user end end + + vaccination_record.strict_loading!(false) + vaccination_record.patient_session.strict_loading!(false) end let(:sample) { SampleClass.new(current_user:) } diff --git a/spec/models/patient_session_spec.rb b/spec/models/patient_session_spec.rb index b526fdf15..c4f1ba655 100644 --- a/spec/models/patient_session_spec.rb +++ b/spec/models/patient_session_spec.rb @@ -136,6 +136,8 @@ let(:patient_session) { create(:patient_session, programme:, patient:) } + before { patient_session.strict_loading!(false) } + context "multiple consent given responses from different parents" do let(:parents) { create_list(:parent, 2) } let(:consents) do diff --git a/spec/models/session_notification_spec.rb b/spec/models/session_notification_spec.rb index c9d7c1910..30377869d 100644 --- a/spec/models/session_notification_spec.rb +++ b/spec/models/session_notification_spec.rb @@ -51,6 +51,8 @@ let(:consent) { create(:consent, :given, patient:, programme:) } let(:current_user) { create(:user) } + before { patient_session.strict_loading!(false) } + context "with a school reminder" do let(:type) { :school_reminder }