Skip to content

Commit bbf0d7c

Browse files
authored
Merge pull request #4493 from nhsuk/fix-filtering-on-record-tab-as-hca-national-protocol-off
Verify that HCA's can't see triaged injected patients when national protocol is off
2 parents a99c5de + 4a63a33 commit bbf0d7c

File tree

3 files changed

+123
-2
lines changed

3 files changed

+123
-2
lines changed

spec/factories/patients.rb

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,82 @@
546546
end
547547
end
548548

549+
trait :consent_given_nasal_triage_safe_to_vaccinate_nasal do
550+
consents do
551+
programmes.map do |programme|
552+
association(
553+
:consent,
554+
:given_nasal,
555+
:from_mum,
556+
:health_question_notes,
557+
patient: instance,
558+
team:,
559+
programme:
560+
)
561+
end
562+
end
563+
564+
consent_statuses do
565+
programmes.map do |programme|
566+
association(
567+
:patient_consent_status,
568+
:given_nasal_only,
569+
patient: instance,
570+
programme:
571+
)
572+
end
573+
end
574+
575+
triage_statuses do
576+
programmes.map do |programme|
577+
association(
578+
:patient_triage_status,
579+
:safe_to_vaccinate_nasal,
580+
patient: instance,
581+
programme:
582+
)
583+
end
584+
end
585+
end
586+
587+
trait :consent_given_injection_and_nasal_triage_safe_to_vaccinate_injection do
588+
consents do
589+
programmes.map do |programme|
590+
association(
591+
:consent,
592+
:given_nasal,
593+
:from_mum,
594+
:health_question_notes,
595+
patient: instance,
596+
team:,
597+
programme:
598+
)
599+
end
600+
end
601+
602+
consent_statuses do
603+
programmes.map do |programme|
604+
association(
605+
:patient_consent_status,
606+
:given_nasal_or_injection,
607+
patient: instance,
608+
programme:
609+
)
610+
end
611+
end
612+
613+
triage_statuses do
614+
programmes.map do |programme|
615+
association(
616+
:patient_triage_status,
617+
:safe_to_vaccinate,
618+
patient: instance,
619+
programme:
620+
)
621+
end
622+
end
623+
end
624+
549625
trait :consent_refused do
550626
triage_not_required
551627

spec/features/flu_vaccination_hca_national_protocol_spec.rb

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,18 @@
3232
then_i_am_able_to_vaccinate_them_using_injection_instead_of_nasal
3333
end
3434

35-
def given_a_session_exists(psd_enabled: false)
35+
scenario "HCA viewing record tab where national protocol is turned off and patient triaged for injection" do
36+
given_a_session_exists(national_protocol_enabled: false)
37+
and_a_nasal_and_injection_patient_exists_triaged_as_safe_vaccinate_with_injection
38+
39+
when_i_visit_the_session_record_tab
40+
then_i_should_not_see_the_patient
41+
end
42+
43+
def given_a_session_exists(
44+
psd_enabled: false,
45+
national_protocol_enabled: true
46+
)
3647
@programme = create(:programme, :flu)
3748
programmes = [@programme]
3849

@@ -65,7 +76,8 @@ def given_a_session_exists(psd_enabled: false)
6576
:national_protocol_enabled,
6677
team: @team,
6778
programmes:,
68-
psd_enabled:
79+
psd_enabled:,
80+
national_protocol_enabled:
6981
)
7082
end
7183

@@ -90,6 +102,15 @@ def and_patients_exist
90102
)
91103
end
92104

105+
def and_a_nasal_and_injection_patient_exists_triaged_as_safe_vaccinate_with_injection
106+
@patient_nasal_and_injection =
107+
create(
108+
:patient,
109+
:consent_given_injection_and_nasal_triage_safe_to_vaccinate_injection,
110+
session: @session
111+
)
112+
end
113+
93114
def and_the_nasal_and_injection_patient_has_a_psd
94115
create(
95116
:patient_specific_direction,
@@ -116,6 +137,10 @@ def then_i_see_only_the_injection_patients
116137
expect(page).to have_content(@patient_injection_only.full_name)
117138
end
118139

140+
def then_i_should_not_see_the_patient
141+
expect(page).not_to have_content(@patient_nasal_and_injection.full_name)
142+
end
143+
119144
def when_i_click_on_the_nasal_only_patient
120145
click_on @patient_nasal_only.full_name
121146
end

spec/features/flu_vaccination_hca_pgd_supply_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
then_i_am_not_able_to_vaccinate_them
2121
end
2222

23+
scenario "Patient consents nasal, has health issues, and is triaged as safe to vaccinate" do
24+
given_a_session_exists
25+
and_a_nasal_patient_exists_with_health_issues_marked_safe_vaccinate_with_nasal
26+
27+
when_i_visit_the_session_record_tab
28+
and_i_click_on_the_nasal_only_patient
29+
then_i_am_able_to_vaccinate_them_nasal_only
30+
end
31+
2332
def given_a_session_exists
2433
@programme = create(:programme, :flu)
2534
programmes = [@programme]
@@ -68,6 +77,15 @@ def and_patients_exist
6877
)
6978
end
7079

80+
def and_a_nasal_patient_exists_with_health_issues_marked_safe_vaccinate_with_nasal
81+
@patient_nasal_only =
82+
create(
83+
:patient,
84+
:consent_given_nasal_triage_safe_to_vaccinate_nasal,
85+
session: @session
86+
)
87+
end
88+
7189
def when_i_visit_the_session_record_tab
7290
sign_in @user, role: :healthcare_assistant
7391
visit session_record_path(@session)
@@ -82,6 +100,8 @@ def then_i_only_see_nasal_spray_patients
82100
def when_i_click_on_the_nasal_only_patient
83101
click_on @patient_nasal_only.full_name
84102
end
103+
alias_method :and_i_click_on_the_nasal_only_patient,
104+
:when_i_click_on_the_nasal_only_patient
85105

86106
def when_i_click_on_the_nasal_and_injection_patient
87107
click_on @patient_nasal_and_injection.full_name

0 commit comments

Comments
 (0)