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

@ -9,7 +9,7 @@ FactoryGirl.define do
venue = create(:venue, conference: program.conference)
end
(event_schedule.room = create(:room, venue: venue)) unless event_schedule.room.present?
(event_schedule.start_time = program.conference.start_date.to_time) unless event_schedule.start_time.present?
(event_schedule.start_time = program.conference.start_date + program.conference.start_hour.hours) unless event_schedule.start_time.present?
unless event_schedule.schedule.present?
unless program.selected_schedule.present?
schedule = create(:schedule, program: program)