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

@ -23,7 +23,7 @@ describe Admin::EventSchedulesController do
schedule_id: schedule.id,
event_id: create(:event, program: conference.program).id,
room_id: create(:room, venue: venue).id,
start_time: conference.start_date)
start_time: conference.start_date + conference.start_hour.hours)
end
it 'saves the event schedule to the database' do
@ -66,7 +66,7 @@ describe Admin::EventSchedulesController do
schedule_id: schedule.id,
event_id: create(:event, program: conference.program).id,
room_id: room.id,
start_time: conference.start_date)
start_time: conference.start_date + conference.start_hour.hours)
event_schedule.reload
end
@ -75,7 +75,7 @@ describe Admin::EventSchedulesController do
end
it 'updates the start_time' do
expect(event_schedule.start_time).to eq(conference.start_date)
expect(event_schedule.start_time).to eq(conference.start_date + conference.start_hour.hours)
end
it 'has 200 status code' do