EventSchedule validations

event, schedule, room and start_time are mandatory in EventSchedule.
This commit is contained in:
Ana 2016-07-26 16:20:31 +02:00
parent 354e15a76d
commit 0b26ed5c35
10 changed files with 26 additions and 15 deletions

View file

@ -39,7 +39,7 @@ describe ConferenceController do
it 'assigns variables' do
expect(assigns(:conference)).to eq conference
expect(assigns(:events_xml)).to eq conference.program.schedules.find(conference.program.selected_schedule).event_schedules.where('start_time IS NOT NULL AND room_id IS NOT NULL')
expect(assigns(:events_xml)).to eq conference.program.schedules.find(conference.program.selected_schedule).event_schedules
.order(start_time: :asc).map(&:event).group_by{ |event| event.scheduled_start_time.to_date }
end

View file

@ -7,4 +7,11 @@ describe EventSchedule do
it { should belong_to(:event) }
it { should belong_to(:room) }
end
describe 'validation' do
it { is_expected.to validate_presence_of(:schedule) }
it { is_expected.to validate_presence_of(:event) }
it { is_expected.to validate_presence_of(:room) }
it { is_expected.to validate_presence_of(:start_time) }
end
end