diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-04-04 16:34:55 +0300 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2019-04-04 20:34:14 +0300 |
commit | f88607923afd5a2adfb7a28df297528cbb27885b (patch) | |
tree | 3415bd1d40ae6bd92c37ac434473c2066dea5f2e /spec/helpers/labels_helper_spec.rb | |
parent | fec2e27f1dcbb806247d6f78ebae628622c02d52 (diff) |
Fix scoped_labels feature check
Check this feature per project/group instead of globally.
Also do not show tooltip if it's disabled.
Diffstat (limited to 'spec/helpers/labels_helper_spec.rb')
-rw-r--r-- | spec/helpers/labels_helper_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/helpers/labels_helper_spec.rb b/spec/helpers/labels_helper_spec.rb index 012678db9c2..a049b5a6133 100644 --- a/spec/helpers/labels_helper_spec.rb +++ b/spec/helpers/labels_helper_spec.rb @@ -249,4 +249,24 @@ describe LabelsHelper do .to match_array([label2, label4, label1, label3]) 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 end |