Skip to content

Commit 4e196e8

Browse files
authored
Merge pull request #6015 from nhsuk/fix-date-time-validation-on-already-vaccinated-flow
Make DraftVaccinationRecord#performed_at_time optional
2 parents 17284c8 + 63faab8 commit 4e196e8

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

app/models/draft_vaccination_record.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ def wizard_steps
8686

8787
on_wizard_step :date_and_time, exact: true do
8888
validates :performed_at_date, presence: true
89-
validates :performed_at_time,
90-
presence: true,
91-
unless: :national_reporting_user_and_record?
9289
validate :performed_at_date_within_range
9390
end
9491

spec/features/mmr_already_had_spec.rb

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
expect(page).to have_content("LocationUnknown")
3737
and_had_been_vaccinated_with_mmr
3838
and_the_dose_number_is_first
39+
and_the_performed_at_date_only_is_set
3940
and_the_consent_requests_are_sent
4041
then_the_parent_doesnt_receive_a_consent_request
4142
end
@@ -72,7 +73,7 @@
7273
when_i_choose_mmrv_and_continue
7374
then_i_see_the_mmrv_date_page
7475

75-
when_i_fill_in_the_date_and_continue
76+
when_i_fill_in_the_date_and_time_and_continue
7677
then_i_see_the_confirmation_page
7778
and_the_confirmation_summary_is_not_displayed_as_a_warning
7879

@@ -83,6 +84,7 @@
8384
and_i_see_that_the_reporter_is_set
8485
and_had_been_vaccinated_with_mmrv
8586
and_the_dose_number_is_second
87+
and_the_performed_at_date_and_time_are_set
8688
and_the_consent_requests_are_sent
8789
then_the_parent_doesnt_receive_a_consent_request
8890
end
@@ -207,13 +209,21 @@ def then_i_see_the_mmr_date_instead_of_the_mmr_or_mmrv_page
207209
expect(page).to have_content("When was the MMR(V) vaccination given?")
208210
end
209211

210-
def when_i_fill_in_the_date_and_continue
212+
def when_i_fill_in_the_date_and_time_and_continue
211213
@vaccination_date = 6.months.ago.to_date
212214
fill_in "Day", with: @vaccination_date.day
213215
fill_in "Month", with: @vaccination_date.month
214216
fill_in "Year", with: @vaccination_date.year
215217
fill_in "Hour", with: "12"
216-
fill_in "Minute", with: "00"
218+
fill_in "Minute", with: "30"
219+
click_on "Continue"
220+
end
221+
222+
def when_i_fill_in_the_date_and_continue
223+
@vaccination_date = 6.months.ago.to_date
224+
fill_in "Day", with: @vaccination_date.day
225+
fill_in "Month", with: @vaccination_date.month
226+
fill_in "Year", with: @vaccination_date.year
217227
click_on "Continue"
218228
end
219229

@@ -283,6 +293,15 @@ def and_the_dose_number_is_second
283293
expect(vaccination_record.dose_sequence).to be(2)
284294
end
285295

296+
def and_the_performed_at_date_and_time_are_set
297+
expect(page).to have_content("Date#{@vaccination_date.strftime('%-d %B %Y')}")
298+
expect(page).to have_content("Time12:30")
299+
end
300+
301+
def and_the_performed_at_date_only_is_set
302+
expect(page).to have_content("Date#{@vaccination_date.strftime('%-d %B %Y')}")
303+
end
304+
286305
def and_the_consent_requests_are_sent
287306
EnqueueSchoolConsentRequestsJob.perform_now
288307
perform_enqueued_jobs

0 commit comments

Comments
 (0)