From 64092b0b0f6bda88944dba6586fa125a2db05f97 Mon Sep 17 00:00:00 2001 From: Alberto Espinoza Date: Thu, 29 Feb 2024 11:08:53 -0600 Subject: [PATCH] R2-2786 Rspec fails due to leap year --- spec/schedules/recalculate_age_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/schedules/recalculate_age_spec.rb b/spec/schedules/recalculate_age_spec.rb index 44960c61f7..792ed2f359 100644 --- a/spec/schedules/recalculate_age_spec.rb +++ b/spec/schedules/recalculate_age_spec.rb @@ -157,19 +157,19 @@ before do clean_data(Child) 25.times do |index| - Child.create(data: { name: "case#{index}'", date_of_birth: Date.today - index.years }) + Child.create(data: { name: "case#{index}'", date_of_birth: Date.current - index.years }) end - @case31 = Child.create(data: { name: "case21'", date_of_birth: Date.today - 5.days }) - @case32 = Child.create(data: { name: "case22'", date_of_birth: Date.today - 5.months }) + @case31 = Child.create(data: { name: "case21'", date_of_birth: Date.current - 5.days }) + @case32 = Child.create(data: { name: "case22'", date_of_birth: Date.current - 5.months }) Sunspot.commit end it 'should return total pages and total_count' do - search = RecalculateAge.new.cases_by_date_of_birth_range(Date.today, Date.today) + search = RecalculateAge.new.cases_by_date_of_birth_range(Date.current, Date.current) expect(search.count).to eq(25) end it 'should not find cases with birthdays not today' do - expect(RecalculateAge.new.cases_by_date_of_birth_range(Date.today, Date.today)).not_to include( + expect(RecalculateAge.new.cases_by_date_of_birth_range(Date.current, Date.current)).not_to include( @case31, @case32 ) end