Skip to content

Commit

Permalink
Double question character limit (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
raccube committed Jan 10, 2022
1 parent dafeb48 commit d3aaaeb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions spec/models/question_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
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

Expand Down

0 comments on commit d3aaaeb

Please sign in to comment.