summaryrefslogtreecommitdiff
path: root/qa/spec/runtime/namespace_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/spec/runtime/namespace_spec.rb')
-rw-r--r--qa/spec/runtime/namespace_spec.rb51
1 files changed, 51 insertions, 0 deletions
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