diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-26 00:08:21 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-26 00:08:21 +0000 |
commit | 3174adc79907c808088a4ede8b891facb9142025 (patch) | |
tree | fcaa30e13a6b9c822ad29c6f9fbf6701d8f4c937 /spec/models | |
parent | 100a5e4beade0d9b636791f347506106829781c3 (diff) | |
download | gitlab-ce-3174adc79907c808088a4ede8b891facb9142025.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/application_setting_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index 8d963d41fce..a26fb33acee 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -105,6 +105,14 @@ describe ApplicationSetting do it { is_expected.not_to allow_value(false).for(:hashed_storage_enabled) } + it { is_expected.not_to allow_value(101).for(:repository_storages_weighted_default) } + it { is_expected.not_to allow_value(-1).for(:repository_storages_weighted_default) } + it { is_expected.to allow_value(100).for(:repository_storages_weighted_default) } + it { is_expected.to allow_value(0).for(:repository_storages_weighted_default) } + it { is_expected.to allow_value(50).for(:repository_storages_weighted_default) } + it { is_expected.to allow_value(nil).for(:repository_storages_weighted_default) } + it { is_expected.not_to allow_value({ default: 100, shouldntexist: 50 }).for(:repository_storages_weighted) } + context 'grafana_url validations' do before do subject.instance_variable_set(:@parsed_grafana_url, nil) @@ -786,4 +794,17 @@ describe ApplicationSetting do end it_behaves_like 'application settings examples' + + describe 'repository_storages_weighted_attributes' do + it 'returns the keys for repository_storages_weighted' do + expect(subject.class.repository_storages_weighted_attributes).to eq([:repository_storages_weighted_default]) + end + end + + it 'does not allow to set weight for non existing storage' do + setting.repository_storages_weighted = { invalid_storage: 100 } + + expect(setting).not_to be_valid + expect(setting.errors.messages[:repository_storages_weighted]).to match_array(["can't include: invalid_storage"]) + end end |