diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-04 00:11:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-04 00:11:13 +0300 |
commit | 63b3a14f15ee5c202d78b7bd72030f4f437ef982 (patch) | |
tree | 7994560f5a6bc1d421ce0fe395031e52d2b4719a /spec/views/admin | |
parent | 9578c9f9e88421a5dc4d9215f40d932bd30cbabc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views/admin')
-rw-r--r-- | spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb | 47 |
1 files changed, 16 insertions, 31 deletions
diff --git a/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb b/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb index dc8f259eb56..2915fe1964f 100644 --- a/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb +++ b/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb @@ -3,49 +3,34 @@ require 'spec_helper' RSpec.describe 'admin/application_settings/_repository_storage.html.haml' do - let(:app_settings) { build(:application_setting, repository_storages_weighted: repository_storages_weighted) } + let(:app_settings) { create(:application_setting) } + let(:repository_storages_weighted_attributes) { [:repository_storages_weighted_default, :repository_storages_weighted_mepmep, :repository_storages_weighted_foobar]} + let(:repository_storages_weighted) do + { + "default" => 100, + "mepmep" => 50 + } + end before do - stub_storage_settings({ 'default': {}, 'mepmep': {}, 'foobar': {} }) + allow(app_settings).to receive(:repository_storages_weighted).and_return(repository_storages_weighted) + allow(app_settings).to receive(:repository_storages_weighted_mepmep).and_return(100) + allow(app_settings).to receive(:repository_storages_weighted_foobar).and_return(50) assign(:application_setting, app_settings) + allow(ApplicationSetting).to receive(:repository_storages_weighted_attributes).and_return(repository_storages_weighted_attributes) end - context 'additional storage config' do - let(:repository_storages_weighted) do - { - 'default' => 100, - 'mepmep' => 50 - } - end - + context 'when multiple storages are available' do it 'lists them all' do render - Gitlab.config.repositories.storages.keys.each do |storage_name| + # lists storages that are saved with weights + repository_storages_weighted.each do |storage_name, storage_weight| expect(rendered).to have_content(storage_name) end + # lists storage not saved with weight expect(rendered).to have_content('foobar') end end - - context 'fewer storage configs' do - let(:repository_storages_weighted) do - { - 'default' => 100, - 'mepmep' => 50, - 'something_old' => 100 - } - end - - it 'lists only configured storages' do - render - - Gitlab.config.repositories.storages.keys.each do |storage_name| - expect(rendered).to have_content(storage_name) - end - - expect(rendered).not_to have_content('something_old') - end - end end |