Commit 5ba40342 authored by Michael Kozono's avatar Michael Kozono

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 gitlab pages size in project and namespace settings

See merge request gitlab-org/gitlab!25677
parents a11f6d3c e65dc7e3
---
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