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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 14:18:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 14:18:50 +0300
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/helpers/application_settings_helper_spec.rb
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/helpers/application_settings_helper_spec.rb')
-rw-r--r--spec/helpers/application_settings_helper_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/helpers/application_settings_helper_spec.rb b/spec/helpers/application_settings_helper_spec.rb
index c2f3e26f97b..3fb754f1090 100644
--- a/spec/helpers/application_settings_helper_spec.rb
+++ b/spec/helpers/application_settings_helper_spec.rb
@@ -123,4 +123,27 @@ describe ApplicationSettingsHelper do
end
end
end
+
+ describe '.storage_weights' do
+ let(:application_setting) { build(:application_setting) }
+
+ before do
+ helper.instance_variable_set(:@application_setting, application_setting)
+ stub_storage_settings({ 'default': {}, 'storage_1': {}, 'storage_2': {} })
+ allow(ApplicationSetting).to receive(:repository_storages_weighted_attributes).and_return(
+ [:repository_storages_weighted_default,
+ :repository_storages_weighted_storage_1,
+ :repository_storages_weighted_storage_2])
+
+ stub_application_setting(repository_storages_weighted: { 'default' => 100, 'storage_1' => 50, 'storage_2' => nil })
+ end
+
+ it 'returns storages correctly' do
+ expect(helper.storage_weights).to eq([
+ { name: :repository_storages_weighted_default, label: 'default', value: 100 },
+ { name: :repository_storages_weighted_storage_1, label: 'storage_1', value: 50 },
+ { name: :repository_storages_weighted_storage_2, label: 'storage_2', value: 0 }
+ ])
+ end
+ end
end