diff options
author | Stan Hu <stanhu@gmail.com> | 2016-10-24 06:57:06 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-10-25 08:40:08 +0300 |
commit | 3e941b136d335b789c7efea46fc3b8af294d3f47 (patch) | |
tree | 6726c3eb9bd2b82ad294a2627a246975cf53e88a /spec/services/issues | |
parent | ddafea060d4b607cd3f5c29e947cdbf6483dcd5d (diff) |
Add spec in Issues::MoveService to fix label assignment regression
Diffstat (limited to 'spec/services/issues')
-rw-r--r-- | spec/services/issues/move_service_spec.rb | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb index 93bf0f64963..8c33389003a 100644 --- a/spec/services/issues/move_service_spec.rb +++ b/spec/services/issues/move_service_spec.rb @@ -23,15 +23,16 @@ 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') - end + new_project.labels << create(:label, title: label) + end + end end describe '#execute' do @@ -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 |