Skip to content

Commit 204a3af

Browse files
committed
wip
1 parent 0209bc1 commit 204a3af

1 file changed

Lines changed: 44 additions & 84 deletions

File tree

spec/components/app_session_overview_component_spec.rb

Lines changed: 44 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
let(:hpv_programme) { Programme.hpv }
77
let(:flu_programme) { Programme.flu }
88
let(:session) { create(:session, programmes: [hpv_programme, flu_programme]) }
9-
let(:latest_location) { session.location }
109

1110
let(:component) { described_class.new(session) }
1211

@@ -66,25 +65,20 @@
6665
context "they have been vaccinated during the session" do
6766
before do
6867
create(
69-
:patient_vaccination_status,
70-
:vaccinated,
68+
:patient_programme_status,
69+
:vaccinated_fully,
7170
patient:,
72-
programme: flu_programme,
73-
latest_location:
71+
programme: flu_programme
7472
)
7573
end
7674

77-
include_examples "displays correct children due vaccination", "Flu", 1
78-
include_examples "displays correct count", "Flu", "No response", 0
79-
include_examples "displays correct count",
80-
"Flu",
81-
"Consent given for nasal",
82-
0
83-
include_examples "displays correct count",
84-
"Flu",
85-
"Consent given for gelatine-free injection",
86-
0
87-
include_examples "displays correct count", "Flu", "Consent refused", 0
75+
include_examples "displays correct children due vaccination", "Flu", 0
76+
include_examples "displays correct count", "Flu", "Needs consent", 0
77+
include_examples "displays correct count", "Flu", "Needs triage", 0
78+
include_examples "displays correct count", "Flu", "Has a refusal", 0
79+
include_examples "displays correct count", "Flu", "Unable to vaccinate", 0
80+
include_examples "displays correct count", "Flu", "Due nasal spray", 0
81+
include_examples "displays correct count", "Flu", "Due injection", 0
8882
include_examples "displays correct count", "Flu", "Vaccinated", 1
8983
end
9084

@@ -93,99 +87,76 @@
9387

9488
before do
9589
create(
96-
:patient_consent_status,
97-
:given_without_gelatine,
90+
:patient_programme_status,
91+
:due_nasal,
9892
patient: patients.first,
9993
programme: flu_programme
10094
)
10195

10296
create(
103-
:patient_consent_status,
104-
:given_nasal_only,
97+
:patient_programme_status,
98+
:due_injection_without_gelatine,
10599
patient: patients.second,
106100
programme: flu_programme
107101
)
108102
end
109103

110104
include_examples "displays correct children due vaccination", "Flu", 2
111-
include_examples "displays correct count", "Flu", "No response", 0
112-
include_examples "displays correct count",
113-
"Flu",
114-
"Consent given for nasal",
115-
1
116-
include_examples "displays correct count",
117-
"Flu",
118-
"Consent given for gelatine-free injection",
119-
1
120-
include_examples "displays correct count", "Flu", "Consent refused", 0
105+
include_examples "displays correct count", "Flu", "Needs consent", 0
106+
include_examples "displays correct count", "Flu", "Needs triage", 0
107+
include_examples "displays correct count", "Flu", "Has a refusal", 0
108+
include_examples "displays correct count", "Flu", "Unable to vaccinate", 0
109+
include_examples "displays correct count", "Flu", "Due nasal spray", 1
110+
include_examples "displays correct count", "Flu", "Due injection", 1
121111
include_examples "displays correct count", "Flu", "Vaccinated", 0
122112
end
123113

124114
context "there's a patient that did not consent" do
125115
before do
126116
create(
127-
:patient_consent_status,
128-
:refused,
117+
:patient_programme_status,
118+
:has_refusal_consent_refused,
129119
patient:,
130120
programme: flu_programme
131121
)
132122
end
133123

134124
include_examples "displays correct children due vaccination", "Flu", 1
135-
include_examples "displays correct count", "Flu", "No response", 0
136-
include_examples "displays correct count",
137-
"Flu",
138-
"Consent given for nasal",
139-
0
140-
include_examples "displays correct count",
141-
"Flu",
142-
"Consent given for gelatine-free injection",
143-
0
144-
include_examples "displays correct count", "Flu", "Consent refused", 1
125+
include_examples "displays correct count", "Flu", "Needs consent", 0
126+
include_examples "displays correct count", "Flu", "Needs triage", 0
127+
include_examples "displays correct count", "Flu", "Has a refusal", 1
128+
include_examples "displays correct count", "Flu", "Unable to vaccinate", 0
129+
include_examples "displays correct count", "Flu", "Due nasal spray", 0
130+
include_examples "displays correct count", "Flu", "Due injection", 0
145131
include_examples "displays correct count", "Flu", "Vaccinated", 0
146132
end
147133

148134
context "patient was vaccinated in previous years" do
149135
before do
150136
create(
151-
:patient_vaccination_status,
152-
:vaccinated,
137+
:patient_programme_status,
138+
:vaccinated_fully,
153139
patient:,
154140
programme: hpv_programme,
155141
academic_year: AcademicYear.current - 1
156142
)
157143
end
158144

159145
include_examples "displays correct children due vaccination", "HPV", 0
160-
include_examples "displays correct count", "HPV", "No response", 0
161-
include_examples "displays correct count", "HPV", "Consent given", 0
162-
include_examples "displays correct count", "HPV", "Consent refused", 0
163-
include_examples "displays correct count", "HPV", "Vaccinated", 0
164146
end
165147

166148
context "patient had seasonal vaccination in previous years" do
167149
before do
168150
create(
169-
:patient_vaccination_status,
170-
:vaccinated,
151+
:patient_programme_status,
152+
:vaccinated_fully,
171153
patient:,
172154
programme: flu_programme,
173155
academic_year: AcademicYear.current - 1
174156
)
175157
end
176158

177159
include_examples "displays correct children due vaccination", "Flu", 1
178-
include_examples "displays correct count", "Flu", "No response", 0
179-
include_examples "displays correct count",
180-
"Flu",
181-
"Consent given for nasal",
182-
0
183-
include_examples "displays correct count",
184-
"Flu",
185-
"Consent given for gelatine-free injection",
186-
0
187-
include_examples "displays correct count", "Flu", "Consent refused", 0
188-
include_examples "displays correct count", "Flu", "Vaccinated", 0
189160
end
190161

191162
context "patient was vaccinated for HPV but elsewhere" do
@@ -201,10 +172,6 @@
201172
end
202173

203174
include_examples "displays correct children due vaccination", "HPV", 0
204-
include_examples "displays correct count", "HPV", "No response", 0
205-
include_examples "displays correct count", "HPV", "Consent given", 0
206-
include_examples "displays correct count", "HPV", "Consent refused", 0
207-
include_examples "displays correct count", "HPV", "Vaccinated", 0
208175
end
209176

210177
context "patient refused HPV vaccine elsewhere" do
@@ -219,10 +186,6 @@
219186
end
220187

221188
include_examples "displays correct children due vaccination", "HPV", 1
222-
include_examples "displays correct count", "HPV", "No response", 0
223-
include_examples "displays correct count", "HPV", "Consent given", 0
224-
include_examples "displays correct count", "HPV", "Consent refused", 0
225-
include_examples "displays correct count", "HPV", "Vaccinated", 0
226189
end
227190

228191
context "with multiple patients and one was vaccinated for HPV elsewhere" do
@@ -248,10 +211,6 @@
248211
end
249212

250213
include_examples "displays correct children due vaccination", "HPV", 1
251-
include_examples "displays correct count", "HPV", "No response", 0
252-
include_examples "displays correct count", "HPV", "Consent given", 0
253-
include_examples "displays correct count", "HPV", "Consent refused", 0
254-
include_examples "displays correct count", "HPV", "Vaccinated", 0
255214
end
256215
end
257216

@@ -260,30 +219,31 @@
260219

261220
before do
262221
create(
263-
:patient_consent_status,
264-
:given_injection_only,
222+
:patient_programme_status,
223+
:has_refusal_consent_refused,
265224
patient: patients.first,
266225
programme: hpv_programme
267226
)
268227
create(
269-
:patient_vaccination_status,
270-
:vaccinated,
228+
:patient_programme_status,
229+
:cannot_vaccinate_unwell,
271230
programme: hpv_programme,
272-
patient: patients.second,
273-
latest_location:
231+
patient: patients.second
274232
)
275233
create(
276-
:patient_consent_status,
277-
:refused,
234+
:patient_programme_status,
235+
:vaccinated_fully,
278236
programme: hpv_programme,
279237
patient: patients.third
280238
)
281239
end
282240

283241
include_examples "displays correct children due vaccination", "HPV", 3
284-
include_examples "displays correct count", "HPV", "No response", 0
285-
include_examples "displays correct count", "HPV", "Consent given", 1
286-
include_examples "displays correct count", "HPV", "Consent refused", 1
242+
include_examples "displays correct count", "HPV", "Needs consent", 0
243+
include_examples "displays correct count", "HPV", "Needs triage", 0
244+
include_examples "displays correct count", "HPV", "Has a refusal", 1
245+
include_examples "displays correct count", "HPV", "Unable to vaccinate", 0
246+
include_examples "displays correct count", "HPV", "Due vaccination", 1
287247
include_examples "displays correct count", "HPV", "Vaccinated", 1
288248
end
289249

0 commit comments

Comments
 (0)