diff options
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 |