[deploy] Add character limits for reported_url and message (#7283)
* Add character limits for reported_url and message * Use one line for reported_url validation * Revert accidental removal of index line * Adjust length limits to account for production values
This commit is contained in:
parent
e1dd1fe9e4
commit
50ba93c232
2 changed files with 4 additions and 1 deletions
|
|
@ -7,7 +7,8 @@ class FeedbackMessage < ApplicationRecord
|
|||
has_many :notes, as: :noteable, inverse_of: :noteable, dependent: :destroy
|
||||
|
||||
validates :feedback_type, :message, presence: true
|
||||
validates :reported_url, :category, presence: { if: :abuse_report? }
|
||||
validates :reported_url, :category, presence: { if: :abuse_report? }, length: { maximum: 250 }
|
||||
validates :message, length: { maximum: 2500 }
|
||||
validates :category,
|
||||
inclusion: {
|
||||
in: ["spam", "other", "rude or vulgar", "harassment", "bug", "listings"]
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ RSpec.describe FeedbackMessage, type: :model do
|
|||
it { is_expected.to validate_presence_of(:feedback_type) }
|
||||
it { is_expected.to validate_presence_of(:reported_url) }
|
||||
it { is_expected.to validate_presence_of(:message) }
|
||||
it { is_expected.to validate_length_of(:reported_url).is_at_most(250) }
|
||||
it { is_expected.to validate_length_of(:message).is_at_most(2500) }
|
||||
|
||||
it do
|
||||
expect(feedback_message).to validate_inclusion_of(:category).
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue