Commit 9d5c6901 authored by jubianchi's avatar jubianchi

Add spec on labels validation

parent 7ad93ab2
...@@ -5,4 +5,27 @@ describe Label do ...@@ -5,4 +5,27 @@ describe Label do
it { label.should be_valid } it { label.should be_valid }
it { should belong_to(:project) } 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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment