Commit e65dc7e3 authored by Vladimir Shushlin's avatar Vladimir Shushlin

Allow 0 for project/namespace max_pages_size as infinity

parent 681b47de
---
title: Allow 0 to be set for pages maximum size per project/group to indicate unlimited
size
merge_request: 25677
author:
type: fixed
......@@ -67,7 +67,7 @@ module EE
validate :validate_shared_runner_minutes_support
validates :max_pages_size,
numericality: { only_integer: true, greater_than: 0, allow_nil: true,
numericality: { only_integer: true, greater_than_or_equal_to: 0, allow_nil: true,
less_than: ::Gitlab::Pages::MAX_SIZE / 1.megabyte }
delegate :trial?, :trial_ends_on, :trial_starts_on, :upgradable?, to: :gitlab_subscription, allow_nil: true
......
......@@ -162,7 +162,7 @@ module EE
validates :repository_size_limit,
numericality: { only_integer: true, greater_than_or_equal_to: 0, allow_nil: true }
validates :max_pages_size,
numericality: { only_integer: true, greater_than: 0, allow_nil: true,
numericality: { only_integer: true, greater_than_or_equal_to: 0, allow_nil: true,
less_than: ::Gitlab::Pages::MAX_SIZE / 1.megabyte }
validates :approvals_before_merge, numericality: true, allow_blank: true
......
......@@ -98,8 +98,8 @@ describe Namespace do
end
context 'validation' do
it do
is_expected.to validate_numericality_of(:max_pages_size).only_integer.is_greater_than(0)
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
end
......
......@@ -206,8 +206,8 @@ describe Project do
it { expect(project).to be_valid }
end
it do
is_expected.to validate_numericality_of(:max_pages_size).only_integer.is_greater_than(0)
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
end
......
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