diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-02-15 15:31:25 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-02-15 15:31:51 +0800 |
commit | cfd839d6f5092be2f5224eddc155f6cf05cd1be6 (patch) | |
tree | 991d7733486399d04d5c9cbade669a12b7aa90c8 /app/models/application_setting.rb | |
parent | 602f3b84c08c06cd132a8c53c7bcbb3a139cebfd (diff) | |
download | gitlab-ce-cfd839d6f5092be2f5224eddc155f6cf05cd1be6.tar.gz |
Fix tests and disallow 0 to make it consistent with .gitlab-ci.yml
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r-- | app/models/application_setting.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 17193036fb6..19af40eacb4 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -306,9 +306,15 @@ class ApplicationSetting < ActiveRecord::Base end def check_default_artifacts_expire_in - ChronicDuration.parse(default_artifacts_expire_in) if - default_artifacts_expire_in - true + return true unless default_artifacts_expire_in + + if ChronicDuration.parse(default_artifacts_expire_in).nil? + errors.add(:default_artifacts_expire_in, + "can't be 0. Leave it blank for unlimited") + false + else + true + end rescue ChronicDuration::DurationParseError => e errors.add(:default_artifacts_expire_in, ": #{e.message}") false |