diff options
author | Patrick Derichs <pderichs@gitlab.com> | 2019-07-24 08:53:29 +0200 |
---|---|---|
committer | Patrick Derichs <pderichs@gitlab.com> | 2019-07-24 10:22:37 +0200 |
commit | 13e7feef08a4b4fd32d553ac58f943a1f8a3d579 (patch) | |
tree | d50026cd1a2c8dc8eaf3af8599b3ef42bdf7e981 /spec | |
parent | 245fdf5610187f172b859edb3da717066bc25867 (diff) | |
download | gitlab-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.rb | 13 |
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 |