Commit 384840bd authored by Vladimir Shushlin's avatar Vladimir Shushlin

Allow 0 for max_pages_size as infinity

parent 20ea35d5
......@@ -137,7 +137,7 @@ class ApplicationSetting < ApplicationRecord
validates :max_pages_size,
presence: true,
numericality: { only_integer: true, greater_than: 0,
numericality: { only_integer: true, greater_than_or_equal_to: 0,
less_than: ::Gitlab::Pages::MAX_SIZE / 1.megabyte }
validates :default_artifacts_expire_in, presence: true, duration: true
......
---
title: Allow 0 for pages size limit setting in admin settings
merge_request: 28086
author:
type: fixed
......@@ -69,12 +69,12 @@ describe ApplicationSetting do
it { is_expected.to validate_numericality_of(:snippet_size_limit).only_integer.is_greater_than(0) }
it { is_expected.to validate_presence_of(:max_artifacts_size) }
it do
is_expected.to validate_numericality_of(:max_pages_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_presence_of(:max_pages_size) }
it 'ensures max_pages_size is an integer greater than 0 (or equal to 0 to indicate unlimited/maximum)' do
is_expected.to validate_numericality_of(:max_pages_size).only_integer.is_greater_than_or_equal_to(0)
.is_less_than(::Gitlab::Pages::MAX_SIZE / 1.megabyte)
end
it { is_expected.to validate_numericality_of(:max_artifacts_size).only_integer.is_greater_than(0) }
it { is_expected.to validate_numericality_of(:max_pages_size).only_integer.is_greater_than(0) }
it { is_expected.not_to allow_value(7).for(:minimum_password_length) }
it { is_expected.not_to allow_value(129).for(:minimum_password_length) }
......
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