clarion/spec/models/track_spec.rb
2014-08-10 20:30:37 +03:00

20 lines
561 B
Ruby

require 'rails_helper'
RSpec.describe Track, :type => :model do
it 'is invalid without a name' do
expect(build(:track, name: '')).to have_error_on :name
end
describe 'color' do
it 'must be present' do
expect(build(:track, color: '')).to have_error_on :color
end
it 'must be a hex RGB triplet' do
expect(build(:track, color: 'foobar')).to have_error_on :color
expect(build(:track, color: '000000')).to_not have_error_on :color
expect(build(:track, color: '#000000')).to_not have_error_on :color
end
end
end