Skip to content
Snippets Groups Projects
Unverified Commit aeda40eb authored by Maxime Orefice's avatar Maxime Orefice
Browse files

Add upcoming_milestones helper

This commit introduces a new method to get upcoming milestones from
a given date. This will be used to schedule migration in n+3 milestone.
parent 22ab1376
Branches andrey-remove-group-caching
No related tags found
Loading
Loading
Loading
@@ -15,6 +15,10 @@ def past_milestone(milestones_ago:)
milestones[current_milestone_index + milestones_ago].version
end
 
def upcoming_milestones
milestones.select { |milestone| Date.parse(milestone.date).future? }.reverse
end
private
 
def current_milestone
Loading
Loading
Loading
Loading
@@ -124,4 +124,17 @@
it { is_expected.to eq(true) }
end
end
describe '#upcoming_milestone', time_travel_to: '2024-04-17' do
subject(:upcoming_milestones) { described_class.new.upcoming_milestones }
it 'returns milestones in the future' do
expected_milestones = [
described_class::Milestone.new(version: '16.11', date: '2024-04-18'),
described_class::Milestone.new(version: '17.0', date: '2024-05-16')
]
expect(upcoming_milestones).to contain_exactly(*expected_milestones)
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment