diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-07-04 15:20:48 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-07-04 15:20:48 +0000 |
commit | fa349c08ce16cdeb6f76e3a4c904f0ebd597cd6d (patch) | |
tree | c57f3a79999704bf8ec09bad6e2775c8a27953fe /spec | |
parent | 170a15514ae6889079d06d0b1be089bda3d29c52 (diff) | |
parent | 4f795ed823776912e8e9d6d4eb33c345ad2b56b9 (diff) | |
download | gitlab-ce-fa349c08ce16cdeb6f76e3a4c904f0ebd597cd6d.tar.gz |
Merge branch '4266-board-with-config-api-ce' into 'master'
Backport of EE changes: Allow Labels::FindOrCreateService to find ancestor group labels
Closes #4266
See merge request gitlab-org/gitlab-ce!20364
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/labels/find_or_create_service_spec.rb | 20 |
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 |