diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-02-15 00:19:36 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-02-15 15:31:51 +0800 |
commit | 602f3b84c08c06cd132a8c53c7bcbb3a139cebfd (patch) | |
tree | 2072a43655467065a28204ea9fbd2324703245b2 /spec/models/application_setting_spec.rb | |
parent | 4eff5eb89fc6eec5692f4119b2fc3c9622d1b3e3 (diff) | |
download | gitlab-ce-602f3b84c08c06cd132a8c53c7bcbb3a139cebfd.tar.gz |
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.rb | 22 |
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 |