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:
authorNick Thomas <nick@gitlab.com>2017-07-10 15:29:16 +0300
committerNick Thomas <nick@gitlab.com>2017-07-10 17:40:51 +0300
commitaeb2869f666a73a039b5ac05bc5973547456ee33 (patch)
treed68a0bc1bcc0188e7847c4f9953da6ab9e534e10 /spec/models/application_setting_spec.rb
parentcd735170d3bc5e71d46ba1e37249ae713b7842f8 (diff)
Prevent bad data being added to application settings when Redis is unavailable
Diffstat (limited to 'spec/models/application_setting_spec.rb')
-rw-r--r--spec/models/application_setting_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index fb485d0b2c6..e600eab6565 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -155,6 +155,18 @@ describe ApplicationSetting, models: true do
end
end
+ describe '.current' do
+ context 'redis unavailable' do
+ it 'returns an ApplicationSetting' do
+ allow(Rails.cache).to receive(:fetch).and_call_original
+ allow(ApplicationSetting).to receive(:last).and_return(:last)
+ expect(Rails.cache).to receive(:fetch).with(ApplicationSetting::CACHE_KEY).and_raise(ArgumentError)
+
+ expect(ApplicationSetting.current).to eq(:last)
+ end
+ end
+ end
+
context 'restricted signup domains' do
it 'sets single domain' do
setting.domain_whitelist_raw = 'example.com'