Commit 8a49eeed authored by Sean McGivern's avatar Sean McGivern

Add failing test for milestone with far-future date

When looking for upcoming milestones, we compare the milestone's due
date to `NOW()`. However, the due date is a date and `NOW()` is a
timestamp, and in Postgres, timestamps can't extend as far in the future
as dates can.

This test exposes the issue.
parent f100c9ba
......@@ -379,6 +379,21 @@ describe Milestone do
expect(milestone_ids).to be_empty
end
end
context 'when there is a milestone with a date after 294276 AD', :postgresql do
before do
past_milestone_project_1.update!(due_date: Date.new(294277, 1, 1))
end
it 'returns the next upcoming open milestone ID for each project and group' do
expect(milestone_ids).to contain_exactly(
current_milestone_project_1.id,
current_milestone_project_2.id,
current_milestone_group_1.id,
current_milestone_group_2.id
)
end
end
end
describe '#to_reference' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment