diff options
author | jubianchi <contact@jubianchi.fr> | 2014-08-20 14:31:16 +0400 |
---|---|---|
committer | jubianchi <contact@jubianchi.fr> | 2014-08-20 14:31:19 +0400 |
commit | 9d5c69019371379d055be8ba963fde78d3e0c7f6 (patch) | |
tree | 27c355af7ed6e2e40fdde3f7c888517353ccb817 /spec/models/label_spec.rb | |
parent | 7ad93ab250019d7737186a0bf8884faf2db2b625 (diff) |
Add spec on labels validation
Diffstat (limited to 'spec/models/label_spec.rb')
-rw-r--r-- | spec/models/label_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/models/label_spec.rb b/spec/models/label_spec.rb index 5098af84cc3..1d273e59bde 100644 --- a/spec/models/label_spec.rb +++ b/spec/models/label_spec.rb @@ -5,4 +5,27 @@ describe Label do it { label.should be_valid } it { should belong_to(:project) } + + describe 'Validation' do + it 'should validate color code' do + build(:label, color: 'G-ITLAB').should_not be_valid + build(:label, color: 'AABBCC').should_not be_valid + build(:label, color: '#AABBCCEE').should_not be_valid + build(:label, color: '#GGHHII').should_not be_valid + build(:label, color: '#').should_not be_valid + build(:label, color: '').should_not be_valid + + build(:label, color: '#AABBCC').should be_valid + end + + it 'should validate title' do + build(:label, title: 'G,ITLAB').should_not be_valid + build(:label, title: 'G?ITLAB').should_not be_valid + build(:label, title: 'G&ITLAB').should_not be_valid + build(:label, title: '').should_not be_valid + + build(:label, title: 'GITLAB').should be_valid + build(:label, title: 'gitlab').should be_valid + end + end end |