Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Chao <mchao@gitlab.com>2018-07-04 12:52:58 +0300
committerMark Chao <mchao@gitlab.com>2018-07-04 15:48:50 +0300
commit4f795ed823776912e8e9d6d4eb33c345ad2b56b9 (patch)
treec4886e114c6de12600c5ad25e5ab9a6cb9257342 /spec/services/labels
parentecf9c145f6e4d170cd059df88743393d9e63c489 (diff)
Backport from EE !5954
Allow Labels::FindOrCreateService to find ancestor group labels Add authentication check on API endpoint Update flayignore
Diffstat (limited to 'spec/services/labels')
-rw-r--r--spec/services/labels/find_or_create_service_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/services/labels/find_or_create_service_spec.rb b/spec/services/labels/find_or_create_service_spec.rb
index 68d5660445a..97ba2742392 100644
--- a/spec/services/labels/find_or_create_service_spec.rb
+++ b/spec/services/labels/find_or_create_service_spec.rb
@@ -44,6 +44,26 @@ describe Labels::FindOrCreateService do
expect(service.execute).to eq project_label
end
end
+
+ context 'when include_ancestor_groups is true' do
+ let(:group) { create(:group, :nested) }
+ let(:params) do
+ {
+ title: 'Audit',
+ include_ancestor_groups: true
+ }
+ end
+
+ it 'returns the ancestor group labels' do
+ group_label = create(:group_label, group: group.parent, title: 'Audit')
+
+ expect(service.execute).to eq group_label
+ end
+
+ it 'creates new labels if labels are not found' do
+ expect { service.execute }.to change(project.labels, :count).by(1)
+ end
+ end
end
context 'when finding labels on group level' do