Double question character limit (#292)
This commit is contained in:
parent
dafeb48223
commit
d3aaaeb12d
|
@ -5,7 +5,7 @@ class Question < ApplicationRecord
|
||||||
has_many :answers, dependent: :destroy
|
has_many :answers, dependent: :destroy
|
||||||
has_many :inboxes, dependent: :destroy
|
has_many :inboxes, dependent: :destroy
|
||||||
|
|
||||||
validates :content, length: { maximum: 255 }
|
validates :content, length: { maximum: 512 }
|
||||||
|
|
||||||
before_destroy do
|
before_destroy do
|
||||||
rep = Report.where(target_id: self.id, type: 'Reports::Question')
|
rep = Report.where(target_id: self.id, type: 'Reports::Question')
|
||||||
|
|
|
@ -16,8 +16,8 @@ RSpec.describe Question, :type => :model do
|
||||||
expect(@question.content).to match 'Is this a question?'
|
expect(@question.content).to match 'Is this a question?'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not save questions longer than 255 characters' do
|
it 'does not save questions longer than 512 characters' do
|
||||||
@question.content = 'X' * 256
|
@question.content = 'X' * 513
|
||||||
expect{@question.save!}.to raise_error(ActiveRecord::RecordInvalid)
|
expect{@question.save!}.to raise_error(ActiveRecord::RecordInvalid)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue