diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/helpers/labels_helper_spec.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) | |
download | gitlab-ce-13.5.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/helpers/labels_helper_spec.rb')
-rw-r--r-- | spec/helpers/labels_helper_spec.rb | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/spec/helpers/labels_helper_spec.rb b/spec/helpers/labels_helper_spec.rb index 77e1d10354c..b93dc03e434 100644 --- a/spec/helpers/labels_helper_spec.rb +++ b/spec/helpers/labels_helper_spec.rb @@ -244,26 +244,6 @@ RSpec.describe LabelsHelper do end end - describe 'label_from_hash' do - it 'builds a group label with whitelisted attributes' do - label = label_from_hash({ title: 'foo', color: 'bar', id: 1, group_id: 1 }) - - expect(label).to be_a(GroupLabel) - expect(label.id).to be_nil - expect(label.title).to eq('foo') - expect(label.color).to eq('bar') - end - - it 'builds a project label with whitelisted attributes' do - label = label_from_hash({ title: 'foo', color: 'bar', id: 1, project_id: 1 }) - - expect(label).to be_a(ProjectLabel) - expect(label.id).to be_nil - expect(label.title).to eq('foo') - expect(label.color).to eq('bar') - end - end - describe '#label_status_tooltip' do let(:status) { 'unsubscribed'.inquiry } @@ -291,4 +271,34 @@ RSpec.describe LabelsHelper do expect(tooltip).to eq('This is an image') end end + + describe '#show_labels_full_path?' do + let_it_be(:group) { create(:group) } + let_it_be(:subgroup) { create(:group, parent: group) } + let_it_be(:project) { create(:project, group: group) } + + context 'within a project' do + it 'returns truthy' do + expect(show_labels_full_path?(project, nil)).to be_truthy + end + end + + context 'within a subgroup' do + it 'returns truthy' do + expect(show_labels_full_path?(nil, subgroup)).to be_truthy + end + end + + context 'within a group' do + it 'returns falsey' do + expect(show_labels_full_path?(nil, group)).to be_falsey + end + end + + context 'within the admin area' do + it 'returns falsey' do + expect(show_labels_full_path?(nil, nil)).to be_falsey + end + end + end end |