Add spec in Issues::MoveService to fix label assignment regression
This commit is contained in:
parent
ddafea060d
commit
3e941b136d
1 changed files with 26 additions and 5 deletions
|
@ -23,14 +23,15 @@ describe Issues::MoveService, services: true do
|
|||
old_project.team << [user, :reporter]
|
||||
new_project.team << [user, :reporter]
|
||||
|
||||
['label1', 'label2'].each do |label|
|
||||
labels = 2.times.map { |x| "label%d" % (x + 1) }
|
||||
|
||||
labels.each do |label|
|
||||
old_issue.labels << create(:label,
|
||||
project_id: old_project.id,
|
||||
title: label)
|
||||
end
|
||||
|
||||
new_project.labels << create(:label, title: 'label1')
|
||||
new_project.labels << create(:label, title: 'label2')
|
||||
new_project.labels << create(:label, title: label)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -277,5 +278,25 @@ describe Issues::MoveService, services: true do
|
|||
it { expect { move }.to raise_error(StandardError, /permissions/) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'movable issue with no assigned labels' do
|
||||
before do
|
||||
old_project.team << [user, :reporter]
|
||||
new_project.team << [user, :reporter]
|
||||
|
||||
labels = 2.times.map { |x| "label%d" % (x + 1) }
|
||||
|
||||
labels.each do |label|
|
||||
new_project.labels << create(:label, title: label)
|
||||
end
|
||||
end
|
||||
|
||||
include_context 'issue move executed'
|
||||
|
||||
it 'does not assign labels to new issue' do
|
||||
expected_label_titles = new_issue.reload.labels.map(&:title)
|
||||
expect(expected_label_titles.size).to eq 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue