Add times to Conference

Add start hour and end hour to conference to be able to make the schedule times changeable
This commit is contained in:
Ana 2016-08-15 12:26:47 +02:00 committed by Ana María Martínez Gómez
parent 7000e63700
commit b80aff3cce
5 changed files with 50 additions and 1 deletions

View file

@ -1545,6 +1545,14 @@ describe Conference do
should validate_presence_of(:end_date)
end
it 'is not valid without a start date' do
should validate_presence_of(:start_hour)
end
it 'is not valid without an end date' do
should validate_presence_of(:end_hour)
end
it 'is not valid with a duplicate short title' do
should validate_uniqueness_of(:short_title)
end
@ -1572,6 +1580,21 @@ describe Conference do
end
end
describe 'valid_times_range?' do
it 'is not valid if start hour is lower than 0' do
expect(subject.start_hour).to be >= 0
end
it 'is not valid if end hour is lower or equal than start hour' do
expect(subject.start_hour).to be < subject.end_hour
end
it 'is not valid if end hour is greater than 24' do
expect(subject.end_hour).to be <= 24
end
end
describe 'before create callbacks' do
it 'has an email setting after creation' do