mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
We should remove all the EventSchedules that belongs_to a Room when it is deleted. Otherwise both the public and admin schedule would fail.
26 lines
745 B
Ruby
26 lines
745 B
Ruby
require 'spec_helper'
|
|
|
|
describe Room do
|
|
subject { create(:room) }
|
|
|
|
describe 'validation' do
|
|
it { should validate_presence_of(:name) }
|
|
it { should validate_presence_of(:venue_id) }
|
|
it { should validate_numericality_of(:size).only_integer.is_greater_than(0).allow_nil }
|
|
end
|
|
|
|
describe 'association' do
|
|
it { should belong_to(:venue) }
|
|
it { should have_many(:event_schedules).dependent(:destroy) }
|
|
end
|
|
|
|
describe 'callback' do
|
|
after { subject.run_callbacks(:create) }
|
|
|
|
it '#generate_guid' do
|
|
regex_base64 = %r{^(?:[A-Za-z_\-0-9+\/]{4}\n?)*(?:[A-Za-z_\-0-9+\/]{2}|[A-Za-z_\-0-9+\/]{3}=)?$}
|
|
expect(subject).to receive(:generate_guid)
|
|
expect(subject.guid).to match regex_base64
|
|
end
|
|
end
|
|
end
|