Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-02-05 12:12:36 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-02-09 14:11:16 +0300
commit1cbc75b53cac7a494d673ee73be126aec131b296 (patch)
treed26f5ecbd673a561ef2df1fa12186ef7c926e2d7 /spec
parentceb342c71648d8055b1dc2c8909a563f82edfcef (diff)
Validate maximum attachment size in application settings
`max_attachment_size` in `ApplicationSetting` should be present, only integers greater than zero are valid. Closes #13188
Diffstat (limited to 'spec')
-rw-r--r--spec/models/application_setting_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index f4c58882757..161a32c51e6 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -66,6 +66,14 @@ describe ApplicationSetting, models: true do
it { is_expected.to allow_value(http).for(:after_sign_out_path) }
it { is_expected.to allow_value(https).for(:after_sign_out_path) }
it { is_expected.not_to allow_value(ftp).for(:after_sign_out_path) }
+
+ it { is_expected.to validate_presence_of(:max_attachment_size) }
+
+ it do
+ is_expected.to validate_numericality_of(:max_attachment_size)
+ .only_integer
+ .is_greater_than(0)
+ end
end
context 'restricted signup domains' do