summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-04-12 15:40:12 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-04-12 15:40:12 +0000
commit18188a53466bf81adb583a4d5be7e21796b33ab3 (patch)
treee3c4e168a087f3f7d5550cdc1d461a6cf0424e58 /spec
parent8fa2c5cae5e403ea5095ea1cd091ac9298465f11 (diff)
parent9a048a6ea2f0c5aeea0d366ebf715b54664a5f70 (diff)
downloadgitlab-ce-18188a53466bf81adb583a4d5be7e21796b33ab3.tar.gz
Merge branch 'fix_spaces_in_label_title' into 'master'
Remove heading and trailing spaces from label's color and title See merge request !10603
Diffstat (limited to 'spec')
-rw-r--r--spec/models/label_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/label_spec.rb b/spec/models/label_spec.rb
index a9139f7d4ab..80ca19acdda 100644
--- a/spec/models/label_spec.rb
+++ b/spec/models/label_spec.rb
@@ -42,11 +42,27 @@ describe Label, models: true do
end
end
+ describe '#color' do
+ it 'strips color' do
+ label = described_class.new(color: ' #abcdef ')
+ label.valid?
+
+ expect(label.color).to eq('#abcdef')
+ end
+ end
+
describe '#title' do
it 'sanitizes title' do
label = described_class.new(title: '<b>foo & bar?</b>')
expect(label.title).to eq('foo & bar?')
end
+
+ it 'strips title' do
+ label = described_class.new(title: ' label ')
+ label.valid?
+
+ expect(label.title).to eq('label')
+ end
end
describe 'priorization' do