clarion/spec/models/hall_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
634 B
Ruby

require 'rails_helper'
RSpec.describe Hall, :type => :model do
it 'is invalid without a name' do
expect(build(:hall, name: '')).to have_error_on :name
end
it 'belongs to a conference' do
conference = create :conference
expect(build(:hall, conference_id: conference.id).conference).to eq conference
end
it 'has many slots' do
hall = create :hall
slot = create :slot, hall: hall
expect(hall.slots).to include slot
end
it 'destroys all associated slots when destroyed' do
hall = create :hall
create :slot, hall: hall
expect { hall.destroy }.to change { Slot.count }.by(-1)
end
end