Skip to content

Commit

Permalink
Disable strict loading in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasleese committed Dec 17, 2024
1 parent 18c298c commit 7691fde
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 5 deletions.
3 changes: 3 additions & 0 deletions spec/components/app_activity_log_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
2 changes: 2 additions & 0 deletions spec/components/app_consent_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand Down
2 changes: 2 additions & 0 deletions spec/components/app_consent_status_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions spec/components/app_outcome_banner_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions spec/components/app_patient_page_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
5 changes: 4 additions & 1 deletion spec/components/app_patient_summary_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

let(:patient) { create(:patient) }

before { patient.strict_loading!(false) }

context "without a vaccination record" do
let(:sessions) { [] }

Expand Down
6 changes: 2 additions & 4 deletions spec/components/app_programme_session_table_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@
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
create_list(:patient_session, 4, session:)

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") }
Expand Down
2 changes: 2 additions & 0 deletions spec/components/app_session_patient_table_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 2 additions & 0 deletions spec/components/app_simple_status_banner_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"/session/patient/triage/new"
)
stub_authorization(allowed: true)

patient_session.strict_loading!(false)
end

let(:user) { create :user }
Expand Down
2 changes: 2 additions & 0 deletions spec/components/app_triage_notes_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions spec/components/app_vaccinate_form_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
)
end

before { patient_session.strict_loading!(false) }

it { should have_css(".nhsuk-card") }

it "has the correct heading" do
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/concerns/patient_tabs_concern_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/concerns/triage_mailer_concern_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:) }
Expand Down
3 changes: 3 additions & 0 deletions spec/controllers/concerns/vaccination_mailer_concern_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:) }
Expand Down
2 changes: 2 additions & 0 deletions spec/models/patient_session_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions spec/models/session_notification_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down

0 comments on commit 7691fde

Please sign in to comment.