clarion/spec/models/track_spec.rb
Petko Bordjukov fac65a167a Add missing specs for Tracks, Halls and Slots
Document the behaviour of Tracks, Slots and Halls with specs. Leave the
association between slots and events pending for now.
2014-11-05 11:45:04 +02:00

25 lines
722 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
it 'belongs to a conference' do
conference = create :conference
expect(build(:track, conference_id: conference.id).conference).to eq conference
end
end