|
424 | 424 | then_i_should_see_the_vaccination_record |
425 | 425 | and_i_should_see_the_patient_based_breadcrumb |
426 | 426 | end |
| 427 | + |
| 428 | + scenario "User edits two vaccination records with different delivery methods" do |
| 429 | + given_i_am_signed_in |
| 430 | + and_a_bulk_uploaded_vaccination_record_exists |
| 431 | + and_a_vaccination_record_with_a_different_delivery_method_exists |
| 432 | + |
| 433 | + when_i_visit_the_first_vaccination_record_directly |
| 434 | + and_i_click_on_edit_vaccination_record |
| 435 | + |
| 436 | + and_i_visit_the_flu_vaccination_record_directly |
| 437 | + and_i_click_on_edit_vaccination_record |
| 438 | + and_i_click_on_save_changes |
| 439 | + |
| 440 | + then_i_should_see_a_success_message |
| 441 | + end |
427 | 442 | end |
428 | 443 |
|
429 | 444 | def given_an_hpv_programme_is_underway |
@@ -541,6 +556,33 @@ def and_a_bulk_uploaded_vaccination_record_exists |
541 | 556 | ) |
542 | 557 | end |
543 | 558 |
|
| 559 | + def and_a_vaccination_record_with_a_different_delivery_method_exists |
| 560 | + @flu_programme = Programme.flu |
| 561 | + @flu_vaccine = @flu_programme.vaccines.first |
| 562 | + @flu_batch = |
| 563 | + create(:batch, :not_expired, team: @team, vaccine: @flu_vaccine) |
| 564 | + |
| 565 | + @flu_vaccination_record = |
| 566 | + create( |
| 567 | + :vaccination_record, |
| 568 | + :sourced_from_bulk_upload, |
| 569 | + uploaded_by: @team.users.first, |
| 570 | + delivery_method: :nasal_spray, |
| 571 | + delivery_site: :nose, |
| 572 | + batch: @flu_batch, |
| 573 | + vaccine: @flu_batch.vaccine, |
| 574 | + patient: @patient, |
| 575 | + programme: @flu_programme, |
| 576 | + performed_by_user: nil, |
| 577 | + performed_by_given_name: "Albus", |
| 578 | + performed_by_family_name: "Dumbledore" |
| 579 | + ) |
| 580 | + |
| 581 | + expect(@flu_vaccination_record.delivery_method).not_to eq( |
| 582 | + @vaccination_record.delivery_method |
| 583 | + ) |
| 584 | + end |
| 585 | + |
544 | 586 | def and_a_delayed_triage_exists |
545 | 587 | delay_date = @vaccination_record.performed_at + 28.days |
546 | 588 | @delayed_triage = |
@@ -996,6 +1038,13 @@ def when_i_visit_the_vaccination_record_directly |
996 | 1038 | visit vaccination_record_path(@vaccination_record) |
997 | 1039 | end |
998 | 1040 |
|
| 1041 | + alias_method :when_i_visit_the_first_vaccination_record_directly, |
| 1042 | + :when_i_visit_the_vaccination_record_directly |
| 1043 | + |
| 1044 | + def and_i_visit_the_flu_vaccination_record_directly |
| 1045 | + visit vaccination_record_path(@flu_vaccination_record) |
| 1046 | + end |
| 1047 | + |
999 | 1048 | def and_i_should_see_the_session_specific_breadcrumb |
1000 | 1049 | breadcrumb = page.find(".nhsuk-breadcrumb") |
1001 | 1050 | expect(breadcrumb).to have_content("Sessions") |
@@ -1030,4 +1079,18 @@ def and_i_should_see_the_patient_based_breadcrumb |
1030 | 1079 | expect(breadcrumb).to have_content("Children") |
1031 | 1080 | expect(breadcrumb).not_to have_content("Sessions") |
1032 | 1081 | end |
| 1082 | + |
| 1083 | + def when_i_edit_the_first_vaccination_record |
| 1084 | + visit vaccination_record_path(@vaccination_record) |
| 1085 | + |
| 1086 | + click_on "Edit vaccination record" |
| 1087 | + click_on "Save changes" |
| 1088 | + end |
| 1089 | + |
| 1090 | + def then_i_should_see_a_success_message |
| 1091 | + expect(page).to have_alert( |
| 1092 | + "Success", |
| 1093 | + text: "Vaccination outcome recorded for flu" |
| 1094 | + ) |
| 1095 | + end |
1033 | 1096 | end |
0 commit comments