|
25 | 25 | {
|
26 | 26 | "CHILD_ADDRESS_LINE_1" => "10 Downing Street",
|
27 | 27 | "CHILD_ADDRESS_LINE_2" => "",
|
28 |
| - "CHILD_PREFERRED_GIVEN_NAME" => "Jim", |
| 28 | + "CHILD_PREFERRED_FIRST_NAME" => "Jim", |
29 | 29 | "CHILD_DATE_OF_BIRTH" => "2010-01-01",
|
30 | 30 | "CHILD_FIRST_NAME" => "Jimmy",
|
31 | 31 | "CHILD_GENDER" => "Male",
|
|
177 | 177 | )
|
178 | 178 | end
|
179 | 179 | end
|
| 180 | + |
| 181 | + context "when uploading different caps name" do |
| 182 | + let(:capitalised_parent_2_data) do |
| 183 | + { |
| 184 | + "PARENT_2_EMAIL" => "jenny@example.com", |
| 185 | + "PARENT_2_NAME" => "Jenny Smith" |
| 186 | + } |
| 187 | + end |
| 188 | + let(:data) { valid_data.merge(capitalised_parent_2_data) } |
| 189 | + |
| 190 | + let!(:existing_parent) do |
| 191 | + create(:parent, full_name: "JENNY SMITH", email: "jenny@example.com") |
| 192 | + end |
| 193 | + |
| 194 | + it { should eq([existing_parent]) } |
| 195 | + end |
180 | 196 | end
|
181 | 197 |
|
182 | 198 | describe "#to_patient" do
|
|
290 | 306 | expect(patient.pending_changes).to include("gender_code" => "male")
|
291 | 307 | end
|
292 | 308 | end
|
| 309 | + |
| 310 | + context "with an existing patient with different capitalisation" do |
| 311 | + let(:data) do |
| 312 | + { |
| 313 | + "CHILD_ADDRESS_LINE_1" => "10 Downing Street", |
| 314 | + "CHILD_PREFERRED_FIRST_NAME" => "Jim", |
| 315 | + "CHILD_DATE_OF_BIRTH" => "2010-01-01", |
| 316 | + "CHILD_FIRST_NAME" => "Jimmy", |
| 317 | + "CHILD_GENDER" => "Male", |
| 318 | + "CHILD_LAST_NAME" => "Smith", |
| 319 | + "CHILD_PREFERRED_LAST_NAME" => "Smithy", |
| 320 | + "CHILD_NHS_NUMBER" => "1234567890", |
| 321 | + "CHILD_POSTCODE" => "sw1a 1aa", |
| 322 | + "CHILD_SCHOOL_URN" => school_urn, |
| 323 | + "CHILD_TOWN" => "London" |
| 324 | + } |
| 325 | + end |
| 326 | + |
| 327 | + let!(:existing_patient) do |
| 328 | + create( |
| 329 | + :patient, |
| 330 | + address_postcode: "SW1A 1AA", |
| 331 | + family_name: "SMITH", |
| 332 | + gender_code: "male", |
| 333 | + given_name: "JIMMY", |
| 334 | + nhs_number: "1234567890", |
| 335 | + address_line_1: "10 DOWNING STREET", |
| 336 | + preferred_given_name: "JIM", |
| 337 | + preferred_family_name: "SMITHY", |
| 338 | + date_of_birth: Date.new(2010, 1, 1), |
| 339 | + address_town: "LONDON" |
| 340 | + ) |
| 341 | + end |
| 342 | + |
| 343 | + it { should eq(existing_patient) } |
| 344 | + |
| 345 | + it "saves the incoming values" do |
| 346 | + expect(patient).to have_attributes( |
| 347 | + address_postcode: "SW1A 1AA", |
| 348 | + family_name: "Smith", |
| 349 | + gender_code: "male", |
| 350 | + given_name: "Jimmy", |
| 351 | + nhs_number: "1234567890", |
| 352 | + address_line_1: "10 Downing Street", |
| 353 | + preferred_given_name: "Jim", |
| 354 | + preferred_family_name: "Smithy", |
| 355 | + address_town: "London" |
| 356 | + ) |
| 357 | + end |
| 358 | + |
| 359 | + it "doesn't stage the capitalisation differences" do |
| 360 | + expect(patient.pending_changes).to be_empty |
| 361 | + end |
| 362 | + end |
293 | 363 | end
|
294 | 364 |
|
295 | 365 | describe "#to_school_move" do
|
|
0 commit comments