added minimum length to abstract in event model
This commit is contained in:
parent
10121ae6d0
commit
f56cafdaf1
3 changed files with 4 additions and 1 deletions
|
|
@ -31,6 +31,7 @@ class Event < ActiveRecord::Base
|
||||||
validate :before_end_of_conference, on: :create
|
validate :before_end_of_conference, on: :create
|
||||||
validates :title, presence: true
|
validates :title, presence: true
|
||||||
validates :abstract, presence: true
|
validates :abstract, presence: true
|
||||||
|
validates_length_of :abstract, minimum: 20
|
||||||
validates :event_type, presence: true
|
validates :event_type, presence: true
|
||||||
validates :program, presence: true
|
validates :program, presence: true
|
||||||
validates :max_attendees, numericality: { only_integer: true, greater_than_or_equal_to: 1, allow_nil: true }
|
validates :max_attendees, numericality: { only_integer: true, greater_than_or_equal_to: 1, allow_nil: true }
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirmed?
|
def confirmed?
|
||||||
!confirmed_at.nil?
|
confirmed_at.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def proposals(conference)
|
def proposals(conference)
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,11 @@ describe Event do
|
||||||
|
|
||||||
it { is_expected.to validate_presence_of(:title) }
|
it { is_expected.to validate_presence_of(:title) }
|
||||||
it { is_expected.to validate_presence_of(:abstract) }
|
it { is_expected.to validate_presence_of(:abstract) }
|
||||||
|
it { should validate_length_of(:abstract).is_at_least(20) }
|
||||||
it { is_expected.to validate_presence_of(:program) }
|
it { is_expected.to validate_presence_of(:program) }
|
||||||
it { is_expected.to validate_presence_of(:event_type) }
|
it { is_expected.to validate_presence_of(:event_type) }
|
||||||
|
|
||||||
|
|
||||||
describe 'max_attendees_no_more_than_room_size' do
|
describe 'max_attendees_no_more_than_room_size' do
|
||||||
before :each do
|
before :each do
|
||||||
unless (venue = event.program.conference.venue)
|
unless (venue = event.program.conference.venue)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue