summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-06-29 06:18:53 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-06-29 06:18:53 +0000
commite46676a6fdfdbc77fd4c4813f917b252eded6d33 (patch)
treeb3421d3f78e330f117e9ee8b02bef11b5ddaf81c /spec/services
parentd810e65a18a87c00c7193b2431fdf72546649768 (diff)
parent6a3f9ceff009c2bb93c005e9bfbf641aa45c1cb3 (diff)
downloadgitlab-ce-e46676a6fdfdbc77fd4c4813f917b252eded6d33.tar.gz
Merge branch 'ccr/maintain_labels' into 'master'
Keep label on issue when moving Closes #46098 See merge request gitlab-org/gitlab-ce!20036
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/issues/move_service_spec.rb26
1 files changed, 23 insertions, 3 deletions
diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb
index a9aee9e100f..609eef76d2c 100644
--- a/spec/services/issues/move_service_spec.rb
+++ b/spec/services/issues/move_service_spec.rb
@@ -5,8 +5,11 @@ describe Issues::MoveService do
let(:author) { create(:user) }
let(:title) { 'Some issue' }
let(:description) { 'Some issue description' }
- let(:old_project) { create(:project) }
- let(:new_project) { create(:project) }
+ let(:group) { create(:group, :private) }
+ let(:sub_group_1) { create(:group, :private, parent: group) }
+ let(:sub_group_2) { create(:group, :private, parent: group) }
+ let(:old_project) { create(:project, namespace: sub_group_1) }
+ let(:new_project) { create(:project, namespace: sub_group_2) }
let(:milestone1) { create(:milestone, project_id: old_project.id, title: 'v9.0') }
let(:old_issue) do
@@ -14,7 +17,7 @@ describe Issues::MoveService do
project: old_project, author: author, milestone: milestone1)
end
- let(:move_service) do
+ subject(:move_service) do
described_class.new(old_project, user)
end
@@ -102,6 +105,23 @@ describe Issues::MoveService do
end
end
+ context 'issue with group labels', :nested_groups do
+ it 'assigns group labels to new issue' do
+ label = create(:group_label, group: group)
+ label_issue = create(:labeled_issue, description: description, project: old_project,
+ milestone: milestone1, labels: [label])
+ old_project.add_reporter(user)
+ new_project.add_reporter(user)
+
+ new_issue = move_service.execute(label_issue, new_project)
+
+ expect(new_issue).to have_attributes(
+ project: new_project,
+ labels: include(label)
+ )
+ end
+ end
+
context 'generic issue' do
include_context 'issue move executed'