diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-31 03:08:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-31 03:08:09 +0300 |
commit | f6e2f302412fcb32b644b379778964791789cb62 (patch) | |
tree | 29ed98fca33be12adc21ee75185a459c668fb7da /spec | |
parent | 95ad46159e4cd93f2b31838199180d824e041994 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/admin/application_settings_controller_spec.rb | 16 | ||||
-rw-r--r-- | spec/models/application_setting_spec.rb | 5 |
2 files changed, 21 insertions, 0 deletions
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index f28465f0555..ea51f3fcdf4 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -104,6 +104,22 @@ describe Admin::ApplicationSettingsController do expect(ApplicationSetting.current.minimum_password_length).to eq(10) end + it 'updates namespace_storage_size_limit setting' do + put :update, params: { application_setting: { namespace_storage_size_limit: '100' } } + + expect(response).to redirect_to(general_admin_application_settings_path) + expect(response).to set_flash[:notice].to('Application settings saved successfully') + expect(ApplicationSetting.current.namespace_storage_size_limit).to eq(100) + end + + it 'does not accept an invalid namespace_storage_size_limit' do + put :update, params: { application_setting: { namespace_storage_size_limit: '-100' } } + + expect(response).to render_template(:general) + expect(assigns(:application_setting).errors[:namespace_storage_size_limit]).to be_present + expect(ApplicationSetting.current.namespace_storage_size_limit).not_to eq(-100) + end + context 'external policy classification settings' do let(:settings) do { diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index 8307f91dfed..3ec6110d789 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -82,6 +82,11 @@ describe ApplicationSetting do it { is_expected.not_to allow_value('abc').for(:minimum_password_length) } it { is_expected.to allow_value(10).for(:minimum_password_length) } + it { is_expected.to allow_value(0).for(:namespace_storage_size_limit) } + it { is_expected.to allow_value(1).for(:namespace_storage_size_limit) } + it { is_expected.not_to allow_value(nil).for(:namespace_storage_size_limit) } + it { is_expected.not_to allow_value(-1).for(:namespace_storage_size_limit) } + context 'grafana_url validations' do before do subject.instance_variable_set(:@parsed_grafana_url, nil) |