diff --git a/app/models/question.rb b/app/models/question.rb index 78ea192d..6c5d5913 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -5,7 +5,7 @@ class Question < ApplicationRecord has_many :answers, dependent: :destroy has_many :inboxes, dependent: :destroy - validates :content, length: { maximum: 255 } + validates :content, length: { maximum: 512 } before_destroy do rep = Report.where(target_id: self.id, type: 'Reports::Question') diff --git a/spec/models/question_spec.rb b/spec/models/question_spec.rb index c56449c1..2e88fc42 100644 --- a/spec/models/question_spec.rb +++ b/spec/models/question_spec.rb @@ -16,8 +16,8 @@ RSpec.describe Question, :type => :model do expect(@question.content).to match 'Is this a question?' end - it 'does not save questions longer than 255 characters' do - @question.content = 'X' * 256 + it 'does not save questions longer than 512 characters' do + @question.content = 'X' * 513 expect{@question.save!}.to raise_error(ActiveRecord::RecordInvalid) end