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:
Diffstat (limited to 'spec/config/settings_spec.rb')
-rw-r--r--spec/config/settings_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/config/settings_spec.rb b/spec/config/settings_spec.rb
index ed873478fc9..6525ae653c9 100644
--- a/spec/config/settings_spec.rb
+++ b/spec/config/settings_spec.rb
@@ -134,4 +134,20 @@ RSpec.describe Settings do
end
end
end
+
+ describe '.encrypted' do
+ before do
+ allow(Gitlab::Application.secrets).to receive(:encryped_settings_key_base).and_return(SecureRandom.hex(64))
+ end
+
+ it 'defaults to using the encrypted_settings_key_base for the key' do
+ expect(Gitlab::EncryptedConfiguration).to receive(:new).with(hash_including(base_key: Gitlab::Application.secrets.encrypted_settings_key_base))
+ Settings.encrypted('tmp/tests/test.enc')
+ end
+
+ it 'returns empty encrypted config when a key has not been set' do
+ allow(Gitlab::Application.secrets).to receive(:encrypted_settings_key_base).and_return(nil)
+ expect(Settings.encrypted('tmp/tests/test.enc').read).to be_empty
+ end
+ end
end