Commit b2ba9483 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'fix-iteration-state-in-automation' into 'master'

Fix iteration state when building iterations in advance

See merge request gitlab-org/gitlab!64422
parents e6839dbb a790592a
...@@ -66,6 +66,7 @@ module Iterations ...@@ -66,6 +66,7 @@ module Iterations
group_id: cadence.group_id, group_id: cadence.group_id,
start_date: start_date, start_date: start_date,
due_date: due_date, due_date: due_date,
state_enum: Iteration::STATE_ENUM_MAP[::Iteration.compute_state(start_date, due_date)],
title: title, title: title,
description: description description: description
} }
......
...@@ -173,6 +173,12 @@ RSpec.describe Iterations::Cadences::CreateIterationsInAdvanceService do ...@@ -173,6 +173,12 @@ RSpec.describe Iterations::Cadences::CreateIterationsInAdvanceService do
"Iteration 5: #{(initial_due_date + 1.week + 1.day).strftime(Date::DATE_FORMATS[:long])} - #{(initial_due_date + 2.weeks).strftime(Date::DATE_FORMATS[:long])}" "Iteration 5: #{(initial_due_date + 1.week + 1.day).strftime(Date::DATE_FORMATS[:long])} - #{(initial_due_date + 2.weeks).strftime(Date::DATE_FORMATS[:long])}"
]) ])
end end
it 'sets the states correctly based on iterations dates' do
subject
expect(group.reload.iterations.order(:start_date).map(&:state)).to eq(%w[closed closed current upcoming upcoming])
end
end end
end end
end end
......
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