mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 11:47:56 +01:00
Modify minimum comment body length
This commit is contained in:
@@ -4,5 +4,5 @@ class Comment < ApplicationRecord
|
|||||||
belongs_to :parent, class_name: 'Comment', optional: true
|
belongs_to :parent, class_name: 'Comment', optional: true
|
||||||
has_many :children, class_name: 'Comment', foreign_key: 'parent_id', dependent: :destroy
|
has_many :children, class_name: 'Comment', foreign_key: 'parent_id', dependent: :destroy
|
||||||
|
|
||||||
validates :body, presence: true, length: { minimum: 4 }
|
validates :body, presence: true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,12 +15,6 @@ RSpec.describe Comment, type: :model do
|
|||||||
expect(empty_body).to be_invalid
|
expect(empty_body).to be_invalid
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has a body with 4 or more characters' do
|
|
||||||
short_body = FactoryBot.build(:comment, body: 'a' * 3)
|
|
||||||
|
|
||||||
expect(short_body).to be_invalid
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'can have no parent' do
|
it 'can have no parent' do
|
||||||
no_parent = FactoryBot.build(:comment, parent: nil)
|
no_parent = FactoryBot.build(:comment, parent: nil)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user