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 ...@@ -67,7 +67,7 @@ module EE
validate :validate_shared_runner_minutes_support validate :validate_shared_runner_minutes_support
validates :max_pages_size, 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 } less_than: ::Gitlab::Pages::MAX_SIZE / 1.megabyte }
delegate :trial?, :trial_ends_on, :trial_starts_on, :upgradable?, to: :gitlab_subscription, allow_nil: true delegate :trial?, :trial_ends_on, :trial_starts_on, :upgradable?, to: :gitlab_subscription, allow_nil: true
......
...@@ -162,7 +162,7 @@ module EE ...@@ -162,7 +162,7 @@ module EE
validates :repository_size_limit, validates :repository_size_limit,
numericality: { only_integer: true, greater_than_or_equal_to: 0, allow_nil: true } numericality: { only_integer: true, greater_than_or_equal_to: 0, allow_nil: true }
validates :max_pages_size, 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 } less_than: ::Gitlab::Pages::MAX_SIZE / 1.megabyte }
validates :approvals_before_merge, numericality: true, allow_blank: true validates :approvals_before_merge, numericality: true, allow_blank: true
......
...@@ -98,8 +98,8 @@ describe Namespace do ...@@ -98,8 +98,8 @@ describe Namespace do
end end
context 'validation' do context 'validation' do
it do 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(0) 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
end end
......
...@@ -206,8 +206,8 @@ describe Project do ...@@ -206,8 +206,8 @@ describe Project do
it { expect(project).to be_valid } it { expect(project).to be_valid }
end end
it do 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(0) 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
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