Commit c509d68c authored by Eulyeon Ko's avatar Eulyeon Ko

Apply reviewer suggestion

parent dd2b277f
......@@ -139,8 +139,8 @@ RSpec.describe Iterations::Cadences::CreateIterationsInAdvanceService do
end
context 'when cadence has iterations but all are in the past' do
let_it_be(:past_iteration1) { create(:iteration, group: group, title: 'Iteration 1', iterations_cadence: automated_cadence, start_date: 3.weeks.ago, due_date: 2.weeks.ago)}
let_it_be(:past_iteration2) { create(:iteration, group: group, title: 'Iteration 2', iterations_cadence: automated_cadence, start_date: past_iteration1.due_date + 1.day, due_date: past_iteration1.due_date + 1.week)}
let_it_be(:past_iteration1) { create(:iteration, group: group, title: 'Iteration 1: some user note', iterations_cadence: automated_cadence, start_date: 3.weeks.ago, due_date: 2.weeks.ago)}
let_it_be(:past_iteration2) { create(:iteration, group: group, title: 'Iteration 2: some user note', iterations_cadence: automated_cadence, start_date: past_iteration1.due_date + 1.day, due_date: past_iteration1.due_date + 1.week)}
before do
automated_cadence.update!(iterations_in_advance: 2)
......@@ -159,40 +159,18 @@ RSpec.describe Iterations::Cadences::CreateIterationsInAdvanceService do
expect(automated_cadence.reload.last_run_date).to eq(automated_cadence.reload.iterations.last(2).first.due_date)
end
it 'sets the title correctly based on iterations count and follow-up dates' do
it 'sets the title correctly based on iterations count without modifying user-edited titles' do
subject
expect(group.reload.iterations.due_date_order_asc.pluck(:title)).to eq([
'Iteration 1',
'Iteration 2',
"Iteration 3",
"Iteration 4",
"Iteration 5"
'Iteration 1: some user note',
'Iteration 2: some user note',
'Iteration 3',
'Iteration 4',
'Iteration 5'
])
end
context 'when cadence changes duration' do
before do
subject
automated_cadence.update!(duration_in_weeks: 3)
automated_cadence.reload
end
it 'adjusts iteration titles for iterations that are autogenerated' do
subject
# change duration and expect the titles for iterations containing dates in title to change
described_class.new(user, automated_cadence).execute
expect(group.reload.iterations.due_date_order_asc.pluck(:title)).to eq([
'Iteration 1',
'Iteration 2',
"Iteration 3",
"Iteration 4",
"Iteration 5"
])
end
end
it 'sets the states correctly based on iterations dates' do
subject
......
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