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 'qa/spec/runtime')
-rw-r--r--qa/spec/runtime/application_settings_spec.rb6
-rw-r--r--qa/spec/runtime/namespace_spec.rb51
2 files changed, 55 insertions, 2 deletions
diff --git a/qa/spec/runtime/application_settings_spec.rb b/qa/spec/runtime/application_settings_spec.rb
index fce0361aee0..e48214b22e6 100644
--- a/qa/spec/runtime/application_settings_spec.rb
+++ b/qa/spec/runtime/application_settings_spec.rb
@@ -16,12 +16,14 @@ describe QA::Runtime::ApplicationSettings do
.with(api_client, '/application/settings')
.and_return(request)
+ expect(described_class).to receive(:get_application_settings)
+
expect(described_class)
.to receive(:put)
.with(request.url, { allow_local_requests_from_web_hooks_and_services: true })
.and_return(Struct.new(:code).new(200))
- subject.set_application_settings(allow_local_requests_from_web_hooks_and_services: true)
+ described_class.set_application_settings(allow_local_requests_from_web_hooks_and_services: true)
end
end
@@ -37,7 +39,7 @@ describe QA::Runtime::ApplicationSettings do
.with(request.url)
.and_return(get_response)
- subject.get_application_settings
+ described_class.get_application_settings
end
end
end
diff --git a/qa/spec/runtime/namespace_spec.rb b/qa/spec/runtime/namespace_spec.rb
new file mode 100644
index 00000000000..d24fa509f30
--- /dev/null
+++ b/qa/spec/runtime/namespace_spec.rb
@@ -0,0 +1,51 @@
+# frozen_string_literal: true
+
+describe QA::Runtime::Namespace do
+ include Helpers::StubENV
+
+ describe '.name' do
+ context 'when CACHE_NAMESPACE_NAME is not defined' do
+ before do
+ stub_env('CACHE_NAMESPACE_NAME', nil)
+ end
+
+ it 'caches name by default' do
+ name = described_class.name
+ expect(described_class.name).to eq(name)
+ end
+
+ it 'does not cache name when reset_cache is true' do
+ name = described_class.name
+ expect(described_class.name(reset_cache: true)).not_to eq(name)
+ end
+ end
+
+ context 'when CACHE_NAMESPACE_NAME is defined' do
+ before do
+ stub_env('CACHE_NAMESPACE_NAME', 'true')
+ end
+
+ it 'caches name by default' do
+ name = described_class.name
+ expect(described_class.name).to eq(name)
+ end
+
+ it 'caches name when reset_cache is false' do
+ name = described_class.name
+ expect(described_class.name(reset_cache: false)).to eq(name)
+ end
+
+ it 'does not cache name when reset_cache is true' do
+ name = described_class.name
+ expect(described_class.name(reset_cache: true)).not_to eq(name)
+ end
+ end
+ end
+
+ describe '.path' do
+ it 'is always cached' do
+ path = described_class.path
+ expect(described_class.path).to eq(path)
+ end
+ end
+end