Commit 243ea254 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch...

Merge branch '199422-maximum-size-for-gitlab-pages-says-to-set-it-to-0-for-unlimited-but-it-doesn-t-accept-a' into 'master'

Allow 0 for max_pages_size as infinity

See merge request gitlab-org/gitlab!28086
parents 09762c21 384840bd
...@@ -137,7 +137,7 @@ class ApplicationSetting < ApplicationRecord ...@@ -137,7 +137,7 @@ class ApplicationSetting < ApplicationRecord
validates :max_pages_size, validates :max_pages_size,
presence: true, 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 } less_than: ::Gitlab::Pages::MAX_SIZE / 1.megabyte }
validates :default_artifacts_expire_in, presence: true, duration: true 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 ...@@ -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_numericality_of(:snippet_size_limit).only_integer.is_greater_than(0) }
it { is_expected.to validate_presence_of(:max_artifacts_size) } it { is_expected.to validate_presence_of(:max_artifacts_size) }
it do it { is_expected.to validate_numericality_of(:max_artifacts_size).only_integer.is_greater_than(0) }
is_expected.to validate_numericality_of(:max_pages_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) .is_less_than(::Gitlab::Pages::MAX_SIZE / 1.megabyte)
end 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(7).for(:minimum_password_length) }
it { is_expected.not_to allow_value(129).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