Skip to content

Commit 49c5a46

Browse files
committed
Extend feature specs to cover activity log
Check that the activity log contains the correct entry for the new vaccination record. Jira-Issue: MAV-3409 Jira-Issue: MAV-2848
1 parent 1dcacbd commit 49c5a46

3 files changed

Lines changed: 31 additions & 7 deletions

File tree

app/components/app_activity_log_component.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ def vaccination_events
401401
if (vaccine = vaccination_record.vaccine)
402402
"Vaccinated with #{vaccine.brand}"
403403
elsif vaccination_record.sourced_from_manual_report? ||
404-
vaccination_record.sourced_from_historical_upload?
404+
vaccination_record.sourced_from_historical_upload?
405405
"Historical vaccination record added"
406406
else
407407
"Vaccinated"
@@ -412,10 +412,13 @@ def vaccination_events
412412

413413
subtitle =
414414
if vaccination_record.administered? &&
415-
vaccination_record.reported_at.present? &&
416-
(vaccination_record.sourced_from_manual_report? ||
417-
vaccination_record.sourced_from_historical_upload?)
418-
"Record added #{vaccination_record.reported_at.to_fs(:long)}. Vaccination given #{vaccination_record.performed_at.to_fs(:long)}."
415+
vaccination_record.reported_at.present? &&
416+
(
417+
vaccination_record.sourced_from_manual_report? ||
418+
vaccination_record.sourced_from_historical_upload?
419+
)
420+
"Record added #{vaccination_record.reported_at.to_fs(:long)}. " \
421+
"Vaccination given #{vaccination_record.performed_at.to_date.to_fs(:long)}."
419422
end
420423

421424
kept = {

spec/components/app_activity_log_component_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@
221221

222222
include_examples "card",
223223
title: "Historical vaccination record added",
224-
date: "Record added 15 December 2025 at 2:33pm. Vaccination given 6 January 2025.",
224+
date:
225+
"Record added 15 December 2025 at 2:33pm. Vaccination given 6 January 2025.",
225226
programme: "Flu"
226227

227228
include_examples "card",

spec/features/mmr_already_had_spec.rb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
when_the_status_updater_runs
6868
and_i_navigate_to_the_patient_record
6969
then_i_see_that_the_vaccination_record_has_outcome_vaccinated
70+
71+
when_i_open_the_activity_log
72+
then_i_see_a_historical_vaccination_log_entry_for_mmr
73+
and_it_includes_the_programme_and_both_reported_and_performed_at_dates
7074
end
7175

7276
scenario "record a patient as already had their 1st MMR dose and then edit dates" do
@@ -416,10 +420,26 @@ def and_i_navigate_to_the_patient_record
416420
end
417421

418422
def then_i_see_that_the_vaccination_record_has_outcome_vaccinated
419-
expect(page).to have_content("Vaccination date #{@vaccination_date.strftime("%-d %B %Y")}")
423+
expect(page).to have_content(
424+
"Vaccination date #{@vaccination_date.strftime("%-d %B %Y")}"
425+
)
420426
expect(page).to have_content("Location Unknown")
421427
expect(page).to have_content("Programme MMR")
422428
expect(page).to have_content("Source Manual report")
423429
expect(page).to have_content("Outcome Vaccinated")
424430
end
431+
432+
def when_i_open_the_activity_log
433+
click_on "Activity log"
434+
end
435+
436+
def then_i_see_a_historical_vaccination_log_entry_for_mmr
437+
expect(page).to have_content("Historical vaccination record added")
438+
end
439+
440+
def and_it_includes_the_programme_and_both_reported_and_performed_at_dates
441+
expect(page).to have_content(
442+
"MMR Record added 1 July 2025 at 12:00am. Vaccination given #{@vaccination_date.strftime("%-d %B %Y")}."
443+
)
444+
end
425445
end

0 commit comments

Comments
 (0)