Add spec for submission limits

This commit is contained in:
CactusPuppy 2021-02-27 11:29:27 -08:00
parent 0aa33c497c
commit f207d070ac
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82

View file

@ -110,6 +110,35 @@ describe Event do
end end
end end
describe '#submission_limit' do
before :each do
event.event_type.maximum_abstract_length = 3
event.event_type.minimum_abstract_length = 2
end
context 'is invalid' do
it 'when submission text is too long' do
event.submission_text = 'four too many words'
expect(event.valid?).to eq false
expect(event.errors[:submission_text]).to eq ['cannot have more than 3 words']
end
it 'when submission text is too short' do
event.submission_text = 'word'
expect(event.valid?).to eq false
expect(event.errors[:submission_text]).to eq ['cannot have less than 2 words']
end
end
context 'is valid' do
it 'when submission text is within limts' do
event.abstract = 'the magic three'
expect(event.valid?).to eq true
expect(event.errors.size).to eq 0
end
end
end
describe '#before_end_of_conference' do describe '#before_end_of_conference' do
context 'is invalid' do context 'is invalid' do
it 'when event is created after the conference end_date, and returns an error message' do it 'when event is created after the conference end_date, and returns an error message' do