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:
authorSean McGivern <sean@gitlab.com>2019-04-05 13:28:19 +0300
committerSean McGivern <sean@gitlab.com>2019-04-05 13:28:19 +0300
commit934dabaf6da42db7197e07dc95cf88d34e847306 (patch)
tree537ca94aeaf22d8ddb411582b3f66c0cd9c6fad2 /spec/helpers
parent39eb16aab2dbac3347f61f83fb60f5448d44e965 (diff)
parentea3831986b63b2e070d9b61c8e307488822acf28 (diff)
Merge branch 'keyval-labels' into 'master'
[CE] Add mutually exclusive labels See merge request gitlab-org/gitlab-ce!26804
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/labels_helper_spec.rb20
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