Skip to content

Commit

Permalink
Use stub_pds_search_to_return_no_patients
Browse files Browse the repository at this point in the history
This updates two feature tests to use the
`stub_pds_search_to_return_no_patients` instead of duplicating the code.
  • Loading branch information
thomasleese committed Nov 28, 2024
1 parent 2eb8523 commit e922b1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
10 changes: 2 additions & 8 deletions spec/features/parent_consent_school_session_completed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
after { Flipper.disable(:release_1b) }

scenario "Move to a completed session" do
stub_pds_search_to_return_no_patients

given_an_hpv_programme_is_underway
and_requests_can_be_made_to_pds

when_i_go_to_the_consent_form
when_i_fill_in_my_childs_name_and_birthday
Expand Down Expand Up @@ -50,13 +51,6 @@ def given_an_hpv_programme_is_underway
@child = create(:patient, session: @scheduled_session)
end

def and_requests_can_be_made_to_pds
stub_request(
:get,
"https://sandbox.api.service.nhs.uk/personal-demographics/FHIR/R4/Patient"
).with(query: hash_including({})).to_return_json(body: { total: 0 })
end

def when_a_nurse_checks_consent_responses
sign_in @organisation.users.first
visit "/dashboard"
Expand Down
16 changes: 6 additions & 10 deletions spec/features/parental_consent_clinic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
after { Flipper.disable(:release_1b) }

scenario "Child attending a clinic goes to a school" do
stub_pds_search_to_return_no_patients

given_an_hpv_programme_is_underway
and_requests_can_be_made_to_pds

when_i_go_to_the_consent_form
and_i_fill_in_my_childs_name_and_birthday
Expand Down Expand Up @@ -36,8 +37,9 @@
end

scenario "Child attending a clinic is home-schooled" do
stub_pds_search_to_return_no_patients

given_an_hpv_programme_is_underway
and_requests_can_be_made_to_pds

when_i_go_to_the_consent_form
and_i_fill_in_my_childs_name_and_birthday
Expand All @@ -64,8 +66,9 @@
end

scenario "Child attending a clinic is not in education" do
stub_pds_search_to_return_no_patients

given_an_hpv_programme_is_underway
and_requests_can_be_made_to_pds

when_i_go_to_the_consent_form
and_i_fill_in_my_childs_name_and_birthday
Expand Down Expand Up @@ -112,13 +115,6 @@ def given_an_hpv_programme_is_underway
create(:school, organisation: @organisation, name: "Pilot School")
end

def and_requests_can_be_made_to_pds
stub_request(
:get,
"https://sandbox.api.service.nhs.uk/personal-demographics/FHIR/R4/Patient"
).with(query: hash_including({})).to_return_json(body: { total: 0 })
end

def when_i_go_to_the_consent_form
visit start_parent_interface_consent_forms_path(@session, @programme)
end
Expand Down

0 comments on commit e922b1a

Please sign in to comment.