|
81 | 81 | "PERFORMING_PROFESSIONAL_FORENAME" => vaccinator.given_name, |
82 | 82 | "PERFORMING_PROFESSIONAL_SURNAME" => vaccinator.family_name, |
83 | 83 | "VACCINE_GIVEN" => "AstraZeneca Fluenz LAIV", |
84 | | - "ANATOMICAL_SITE" => "nasal", |
| 84 | + "ANATOMICAL_SITE" => "nasal" |
85 | 85 | ) |
86 | 86 | end |
87 | 87 | let(:valid_national_reporting_hpv_data) do |
|
123 | 123 | context "with headers, but an empty row" do |
124 | 124 | let(:data) do |
125 | 125 | { |
| 126 | + "ORGANISATION_CODE" => "", |
| 127 | + "SCHOOL_NAME" => "", |
| 128 | + "SCHOOL_URN" => "", |
126 | 129 | "NHS_NUMBER" => "", |
127 | 130 | "PERSON_FORENAME" => "", |
128 | 131 | "PERSON_SURNAME" => "", |
|
132 | 135 | "PROGRAMME" => "", |
133 | 136 | "DATE_OF_VACCINATION" => "", |
134 | 137 | "REASON_NOT_VACCINATED" => "", |
135 | | - "VACCINATED" => "" |
| 138 | + "VACCINATED" => "", |
| 139 | + "BATCH_EXPIRY_DATE" => "", |
| 140 | + "BATCH_NUMBER" => "", |
| 141 | + "ANATOMICAL_SITE" => "", |
| 142 | + "PERFORMING_PROFESSIONAL_FORENAME" => "", |
| 143 | + "PERFORMING_PROFESSIONAL_SURNAME" => "", |
| 144 | + "VACCINE_GIVEN" => "" |
136 | 145 | } |
137 | 146 | end |
138 | 147 |
|
139 | 148 | it "has the correct errors" do |
140 | 149 | expect(immunisation_import_row).to be_invalid |
141 | | - expect(immunisation_import_row.errors[:base]).to be_empty |
142 | 150 |
|
143 | | - expect(immunisation_import_row.errors["PERSON_FORENAME"]).to eq( |
144 | | - ["Enter a first name."] |
145 | | - ) |
146 | | - expect(immunisation_import_row.errors["PERSON_SURNAME"]).to eq( |
147 | | - ["Enter a last name."] |
148 | | - ) |
149 | | - expect(immunisation_import_row.errors["PERSON_DOB"]).to eq( |
150 | | - ["Enter a date of birth."] |
151 | | - ) |
152 | | - expect(immunisation_import_row.errors["PERSON_POSTCODE"]).to eq( |
153 | | - ["Enter a valid postcode, such as SW1A 1AA."] |
154 | | - ) |
155 | | - expect(immunisation_import_row.errors["PERSON_GENDER_CODE"]).to eq( |
156 | | - ["Enter a gender or gender code."] |
157 | | - ) |
158 | | - expect(immunisation_import_row.errors["PROGRAMME"]).to eq( |
159 | | - ["Enter a programme."] |
160 | | - ) |
161 | | - expect(immunisation_import_row.errors["DATE_OF_VACCINATION"]).to eq( |
162 | | - ["Enter a date."] |
163 | | - ) |
164 | | - expect(immunisation_import_row.errors["REASON_NOT_VACCINATED"]).to eq( |
165 | | - ["Enter a valid reason."] |
166 | | - ) |
167 | | - expect(immunisation_import_row.errors["VACCINATED"]).to eq( |
168 | | - [ |
169 | | - "You need to record whether the child was vaccinated or not. Enter ‘Y’ or ‘N’ in the ‘VACCINATED’ column." |
170 | | - ] |
| 151 | + expect(immunisation_import_row.errors.to_hash).to eq( |
| 152 | + { |
| 153 | + VACCINATED: [ |
| 154 | + "You need to record whether the child was vaccinated or not. " \ |
| 155 | + "Enter ‘Y’ or ‘N’ in the ‘VACCINATED’ column." |
| 156 | + ], |
| 157 | + DATE_OF_VACCINATION: ["Enter a date."], |
| 158 | + PERSON_DOB: ["Enter a date of birth."], |
| 159 | + PERSON_FORENAME: ["Enter a first name."], |
| 160 | + PERSON_GENDER_CODE: ["Enter a gender or gender code."], |
| 161 | + PERSON_SURNAME: ["Enter a last name."], |
| 162 | + PERSON_POSTCODE: ["Enter a valid postcode, such as SW1A 1AA."], |
| 163 | + PROGRAMME: ["Enter a programme."], |
| 164 | + REASON_NOT_VACCINATED: ["Enter a valid reason."] |
| 165 | + } |
171 | 166 | ) |
172 | 167 | end |
173 | 168 | end |
|
1208 | 1203 | include_examples "it is equivalent to `VACCINATED` being `Y`" |
1209 | 1204 | end |
1210 | 1205 |
|
| 1206 | + context "with headers, but an empty row" do |
| 1207 | + let(:data) do |
| 1208 | + { |
| 1209 | + "ORGANISATION_CODE" => "", |
| 1210 | + "SCHOOL_NAME" => "", |
| 1211 | + "SCHOOL_URN" => "", |
| 1212 | + "NHS_NUMBER" => "", |
| 1213 | + "PERSON_FORENAME" => "", |
| 1214 | + "PERSON_SURNAME" => "", |
| 1215 | + "PERSON_DOB" => "", |
| 1216 | + "PERSON_POSTCODE" => "", |
| 1217 | + "PERSON_GENDER_CODE" => "", |
| 1218 | + "DATE_OF_VACCINATION" => "", |
| 1219 | + "VACCINATED" => "", |
| 1220 | + "PERFORMING_PROFESSIONAL_FORENAME" => "", |
| 1221 | + "PERFORMING_PROFESSIONAL_SURNAME" => "", |
| 1222 | + "VACCINE_GIVEN" => "", |
| 1223 | + "ANATOMICAL_SITE" => "", |
| 1224 | + "BATCH_EXPIRY_DATE" => "", |
| 1225 | + "BATCH_NUMBER" => "", |
| 1226 | + "LOCAL_PATIENT_ID" => "", |
| 1227 | + "LOCAL_PATIENT_ID_URI" => "" |
| 1228 | + } |
| 1229 | + end |
| 1230 | + |
| 1231 | + it "has the correct errors" do |
| 1232 | + expect(immunisation_import_row).to be_invalid |
| 1233 | + |
| 1234 | + expect(immunisation_import_row.errors.to_hash).to eq( |
| 1235 | + { |
| 1236 | + BATCH_EXPIRY_DATE: ["Enter a batch expiry date."], |
| 1237 | + BATCH_NUMBER: ["Enter a batch number."], |
| 1238 | + DATE_OF_VACCINATION: ["Enter a date."], |
| 1239 | + ANATOMICAL_SITE: ["Enter an anatomical site."], |
| 1240 | + LOCAL_PATIENT_ID: ["Enter a local patient ID."], |
| 1241 | + LOCAL_PATIENT_ID_URI: ["Enter a local patient ID URI."], |
| 1242 | + PERSON_DOB: ["Enter a date of birth."], |
| 1243 | + PERSON_FORENAME: ["Enter a first name."], |
| 1244 | + PERSON_GENDER_CODE: ["Enter a gender or gender code."], |
| 1245 | + PERSON_SURNAME: ["Enter a last name."], |
| 1246 | + PERSON_POSTCODE: ["Enter a valid postcode, such as SW1A 1AA."], |
| 1247 | + ORGANISATION_CODE: ["Enter an organisation code."], |
| 1248 | + SCHOOL_URN: ["Enter a school URN."], |
| 1249 | + VACCINE_GIVEN: ["Enter a vaccine name."] |
| 1250 | + } |
| 1251 | + ) |
| 1252 | + end |
| 1253 | + end |
| 1254 | + |
1211 | 1255 | context "when `VACCINATED` is `Y`" do |
1212 | 1256 | let(:data) { basic_flu_data.merge({ "VACCINATED" => "Y" }) } |
1213 | 1257 |
|
|
2664 | 2708 | end |
2665 | 2709 |
|
2666 | 2710 | context "of type flu" do |
2667 | | - shared_examples "accepts a VACCINE_GIVEN code" do |vaccine_given, snomed_product_code, anatomical_site: "right deltoid"| |
| 2711 | + shared_examples "accepts a VACCINE_GIVEN code" do |vaccine_given, snomed_product_code, anatomical_site| |
2668 | 2712 | context "with code: #{vaccine_given}" do |
2669 | 2713 | let(:data) do |
2670 | 2714 | valid_national_reporting_flu_data.merge( |
2671 | 2715 | "VACCINE_GIVEN" => vaccine_given, |
2672 | | - "ANATOMICAL_SITE" => anatomical_site |
| 2716 | + "ANATOMICAL_SITE" => anatomical_site || "right deltoid" |
2673 | 2717 | ) |
2674 | 2718 | end |
2675 | 2719 |
|
|
2763 | 2807 | include_examples "accepts a VACCINE_GIVEN code", |
2764 | 2808 | "AstraZeneca Fluenz LAIV", |
2765 | 2809 | "43208811000001106", |
2766 | | - anatomical_site: "nasal" |
| 2810 | + "nasal" |
2767 | 2811 | include_examples "accepts a VACCINE_GIVEN code", |
2768 | 2812 | "Viatris Quadrivalent Influvac sub - unit Tetra - QIVe", |
2769 | 2813 | "45354911000001100" |
|
0 commit comments