Double question character limit (#292)

This commit is contained in:
Karina Kwiatek 2022-01-10 22:01:47 +01:00 committed by GitHub
parent dafeb48223
commit d3aaaeb12d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -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')

View File

@ -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