diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-02-05 12:12:36 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-02-09 14:11:16 +0300 |
commit | 1cbc75b53cac7a494d673ee73be126aec131b296 (patch) | |
tree | d26f5ecbd673a561ef2df1fa12186ef7c926e2d7 /spec | |
parent | ceb342c71648d8055b1dc2c8909a563f82edfcef (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.rb | 8 |
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 |