Commit f9f80ec6 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'validate-suggestion-commit-message' into 'master'

Add suggestion_commit_message length validation

See merge request gitlab-org/gitlab!74310
parents de18ae10 df221309
...@@ -494,6 +494,7 @@ class Project < ApplicationRecord ...@@ -494,6 +494,7 @@ class Project < ApplicationRecord
validates :variables, nested_attributes_duplicates: { scope: :environment_scope } validates :variables, nested_attributes_duplicates: { scope: :environment_scope }
validates :bfg_object_map, file_size: { maximum: :max_attachment_size } validates :bfg_object_map, file_size: { maximum: :max_attachment_size }
validates :max_artifacts_size, numericality: { only_integer: true, greater_than: 0, allow_nil: true } validates :max_artifacts_size, numericality: { only_integer: true, greater_than: 0, allow_nil: true }
validates :suggestion_commit_message, length: { maximum: 255 }
# Scopes # Scopes
scope :pending_delete, -> { where(pending_delete: true) } scope :pending_delete, -> { where(pending_delete: true) }
......
...@@ -346,6 +346,7 @@ RSpec.describe Project, factory_default: :keep do ...@@ -346,6 +346,7 @@ RSpec.describe Project, factory_default: :keep do
it { is_expected.to validate_presence_of(:namespace) } it { is_expected.to validate_presence_of(:namespace) }
it { is_expected.to validate_presence_of(:repository_storage) } it { is_expected.to validate_presence_of(:repository_storage) }
it { is_expected.to validate_numericality_of(:max_artifacts_size).only_integer.is_greater_than(0) } it { is_expected.to validate_numericality_of(:max_artifacts_size).only_integer.is_greater_than(0) }
it { is_expected.to validate_length_of(:suggestion_commit_message).is_at_most(255) }
it 'validates build timeout constraints' do it 'validates build timeout constraints' do
is_expected.to validate_numericality_of(:build_timeout) is_expected.to validate_numericality_of(:build_timeout)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment