|
178 | 178 | )
|
179 | 179 | end
|
180 | 180 | end
|
| 181 | + |
| 182 | + context "when uploading different caps name" do |
| 183 | + let(:capitalised_parent_2_data) do |
| 184 | + { |
| 185 | + "PARENT_2_EMAIL" => "jenny@example.com", |
| 186 | + "PARENT_2_NAME" => "Jenny Smith" |
| 187 | + } |
| 188 | + end |
| 189 | + let(:data) { valid_data.merge(capitalised_parent_2_data) } |
| 190 | + |
| 191 | + let!(:existing_parent) do |
| 192 | + create(:parent, full_name: "JENNY SMITH", email: "jenny@example.com") |
| 193 | + end |
| 194 | + |
| 195 | + it { should eq([existing_parent]) } |
| 196 | + end |
181 | 197 | end
|
182 | 198 |
|
183 | 199 | describe "#to_patient" do
|
|
242 | 258 | family_name: "Smith",
|
243 | 259 | gender_code: "not_known",
|
244 | 260 | given_name: "Jimmy",
|
| 261 | + preferred_given_name: "Jim", |
245 | 262 | nhs_number: "9990000018",
|
246 | 263 | address_line_1: "10 Downing Street",
|
247 | 264 | address_line_2: "",
|
|
267 | 284 | let!(:existing_patient) do
|
268 | 285 | create(
|
269 | 286 | :patient,
|
| 287 | + address_line_1: "10 Downing Street", |
| 288 | + address_line_2: "", |
| 289 | + address_town: "London", |
270 | 290 | address_postcode: "SW1A 1AA",
|
| 291 | + given_name: "Jimmy", |
271 | 292 | family_name: "Smith",
|
| 293 | + preferred_given_name: "Jim", |
272 | 294 | gender_code: "female",
|
273 |
| - given_name: "Jimmy", |
274 | 295 | nhs_number: "9990000018",
|
275 |
| - address_line_1: "10 Downing Street", |
276 |
| - address_line_2: "", |
277 |
| - address_town: "London", |
278 | 296 | birth_academic_year: 2009,
|
279 | 297 | date_of_birth: Date.new(2010, 1, 1),
|
280 | 298 | registration: "8AB"
|
|
366 | 384 | :patient,
|
367 | 385 | family_name: "Smith",
|
368 | 386 | given_name: "Jimmy",
|
| 387 | + preferred_given_name: "Jim", |
369 | 388 | gender_code: "male",
|
370 | 389 | nhs_number: "9990000018",
|
371 | 390 | birth_academic_year: 2009,
|
|
400 | 419 | :patient,
|
401 | 420 | family_name: "Smith",
|
402 | 421 | given_name: "Jimmy",
|
| 422 | + preferred_given_name: "Jim", |
403 | 423 | gender_code: "male",
|
404 | 424 | nhs_number: "9990000018",
|
405 | 425 | birth_academic_year: 2009,
|
|
465 | 485 | )
|
466 | 486 | end
|
467 | 487 | end
|
| 488 | + |
| 489 | + context "with an existing patient with different capitalisation" do |
| 490 | + let(:data) do |
| 491 | + { |
| 492 | + "CHILD_ADDRESS_LINE_1" => "10 Downing Street", |
| 493 | + "CHILD_PREFERRED_FIRST_NAME" => "Jim", |
| 494 | + "CHILD_DATE_OF_BIRTH" => "2010-01-01", |
| 495 | + "CHILD_FIRST_NAME" => "Jimmy", |
| 496 | + "CHILD_GENDER" => "Male", |
| 497 | + "CHILD_LAST_NAME" => "Smith", |
| 498 | + "CHILD_PREFERRED_LAST_NAME" => "Smithy", |
| 499 | + "CHILD_NHS_NUMBER" => "9990000018", |
| 500 | + "CHILD_POSTCODE" => "sw1a 1aa", |
| 501 | + "CHILD_SCHOOL_URN" => school_urn, |
| 502 | + "CHILD_TOWN" => "London" |
| 503 | + } |
| 504 | + end |
| 505 | + |
| 506 | + let!(:existing_patient) do |
| 507 | + create( |
| 508 | + :patient, |
| 509 | + address_postcode: "SW1A 1AA", |
| 510 | + family_name: "SMITH", |
| 511 | + gender_code: "male", |
| 512 | + given_name: "JIMMY", |
| 513 | + nhs_number: "9990000018", |
| 514 | + address_line_1: "10 DOWNING STREET", |
| 515 | + preferred_given_name: "JIM", |
| 516 | + preferred_family_name: "SMITHY", |
| 517 | + date_of_birth: Date.new(2010, 1, 1), |
| 518 | + address_town: "LONDON" |
| 519 | + ) |
| 520 | + end |
| 521 | + |
| 522 | + it { should eq(existing_patient) } |
| 523 | + |
| 524 | + it "saves the incoming values" do |
| 525 | + expect(patient).to have_attributes( |
| 526 | + address_postcode: "SW1A 1AA", |
| 527 | + family_name: "Smith", |
| 528 | + gender_code: "male", |
| 529 | + given_name: "Jimmy", |
| 530 | + nhs_number: "9990000018", |
| 531 | + address_line_1: "10 Downing Street", |
| 532 | + preferred_given_name: "Jim", |
| 533 | + preferred_family_name: "Smithy", |
| 534 | + address_town: "London" |
| 535 | + ) |
| 536 | + end |
| 537 | + |
| 538 | + it "doesn't stage the capitalisation differences" do |
| 539 | + expect(patient.pending_changes).to be_empty |
| 540 | + end |
| 541 | + end |
468 | 542 | end
|
469 | 543 |
|
470 | 544 | describe "#to_school_move" do
|
|
0 commit comments