Added validation in EventSchedule model and test in event_schedule_spec

EventSchedule start time should be in hours range of the conference.Therefore it adds validation on start_time attribute of event schedule model. It also adds test for the same.
This commit is contained in:
Siddhant Bajaj 2017-04-22 01:20:05 +05:30
parent be33f345a1
commit 95d459f058
6 changed files with 48 additions and 8 deletions

View file

@ -98,8 +98,8 @@ describe ApplicationHelper, type: :helper do
@other_event = create(:event, program: conference.program, state: 'confirmed')
schedule = create(:schedule, program: conference.program)
conference.program.update_attributes!(selected_schedule: schedule)
@event_schedule = create(:event_schedule, event: event, start_time: conference.start_date, room: create(:room), schedule: schedule)
@other_event_schedule = create(:event_schedule, event: @other_event, start_time: conference.start_date, room: create(:room), schedule: schedule)
@event_schedule = create(:event_schedule, event: event, start_time: conference.start_date + conference.start_hour.hours, room: create(:room), schedule: schedule)
@other_event_schedule = create(:event_schedule, event: @other_event, start_time: conference.start_date + conference.start_hour.hours, room: create(:room), schedule: schedule)
end
describe 'does return correct concurrent events' do