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
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-02-14 19:19:36 +0300
committerLin Jen-Shin <godfat@godfat.org>2017-02-15 10:31:51 +0300
commit602f3b84c08c06cd132a8c53c7bcbb3a139cebfd (patch)
tree2072a43655467065a28204ea9fbd2324703245b2 /spec/models/application_setting_spec.rb
parent4eff5eb89fc6eec5692f4119b2fc3c9622d1b3e3 (diff)
Add a few more tests and make sure empty value sets to nil
Diffstat (limited to 'spec/models/application_setting_spec.rb')
-rw-r--r--spec/models/application_setting_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index b950fcdd81a..15632bac094 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -29,6 +29,28 @@ describe ApplicationSetting, models: true do
it { is_expected.not_to allow_value(['test']).for(:disabled_oauth_sign_in_sources) }
end
+ describe 'default_artifacts_expire_in' do
+ it 'sets an error if it is invalid' do
+ setting.update(default_artifacts_expire_in: 'a')
+
+ expect(setting).to be_invalid
+ end
+
+ it 'sets the value if it is valid' do
+ setting.update(default_artifacts_expire_in: '30 days')
+
+ expect(setting).to be_valid
+ expect(setting.default_artifacts_expire_in).to eq('30 days')
+ end
+
+ it 'does not set it if it is blank' do
+ setting.update(default_artifacts_expire_in: ' ')
+
+ expect(setting).to be_valid
+ expect(setting.default_artifacts_expire_in).to be_nil
+ end
+ end
+
it { is_expected.to validate_presence_of(:max_attachment_size) }
it do