summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPatrick Derichs <pderichs@gitlab.com>2019-07-24 08:53:29 +0200
committerPatrick Derichs <pderichs@gitlab.com>2019-07-24 10:22:37 +0200
commit13e7feef08a4b4fd32d553ac58f943a1f8a3d579 (patch)
treed50026cd1a2c8dc8eaf3af8599b3ef42bdf7e981 /spec
parent245fdf5610187f172b859edb3da717066bc25867 (diff)
downloadgitlab-ce-13e7feef08a4b4fd32d553ac58f943a1f8a3d579.tar.gz
Add where condition to filter out invalid labels with nil type63730-fix-500-status-labels-pd
Diffstat (limited to 'spec')
-rw-r--r--spec/models/label_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/label_spec.rb b/spec/models/label_spec.rb
index 5174c590a10..c2e2298823e 100644
--- a/spec/models/label_spec.rb
+++ b/spec/models/label_spec.rb
@@ -193,4 +193,17 @@ describe Label do
expect(described_class.optionally_subscribed_by(nil)).to match_array([label, label2])
end
end
+
+ describe '#templates' do
+ context 'with invalid template labels' do
+ it 'returns only valid template labels' do
+ create(:label)
+ # Project labels should not have template set to true
+ create(:label, template: true)
+ valid_template_label = described_class.create!(title: 'test', template: true, type: nil)
+
+ expect(described_class.templates).to eq([valid_template_label])
+ end
+ end
+ end
end