2020-11-24 15:15:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
RSpec.describe QA::Runtime::Namespace do
|
2021-11-11 11:23:49 +05:30
|
|
|
include QA::Support::Helpers::StubEnv
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
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
|