We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ecc502a + 1febc1c commit 58ffcccCopy full SHA for 58ffccc
1 file changed
spec/lib/status_generator/vaccination_spec.rb
@@ -345,7 +345,16 @@
345
:vaccination_record,
346
patient:,
347
programme:,
348
- performed_at: patient.date_of_birth + 1.year + 3.months
+ performed_at:
349
+ (patient.date_of_birth + 1.year + 3.months).then do
350
+ # When date is at the end of the month, adding months to it
351
+ # results in dates that are also at the end of the month,
352
+ # which can cause test failures. For example if dob is
353
+ # 2021-01-31, then 1 year + 3 months is 2022-04-30, but when
354
+ # AgeConcern#age_months calculates age, the result is 14
355
+ # months, triggering a false negative in our test here.
356
+ it == it.end_of_month ? it + 1.day : it
357
+ end
358
)
359
end
360
0 commit comments