diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-05 15:10:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-05 15:10:25 +0300 |
commit | f7406657b9ed27af2970a88ce4f73c35b162dfb8 (patch) | |
tree | e52c79f89a4dfd5eb66b1aa100edaea1cff0a547 /spec/support/redis | |
parent | c6050cf3204ebd5f554870881952aa8e24324269 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/redis')
-rw-r--r-- | spec/support/redis/redis_shared_examples.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/support/redis/redis_shared_examples.rb b/spec/support/redis/redis_shared_examples.rb index dd916aea3e8..72b3a72f9d4 100644 --- a/spec/support/redis/redis_shared_examples.rb +++ b/spec/support/redis/redis_shared_examples.rb @@ -87,6 +87,43 @@ RSpec.shared_examples "redis_shared_examples" do end end + describe '.store' do + let(:rails_env) { 'development' } + + subject { described_class.new(rails_env).store } + + shared_examples 'redis store' do + it 'instantiates Redis::Store' do + is_expected.to be_a(::Redis::Store) + expect(subject.to_s).to eq("Redis Client connected to #{host} against DB #{redis_database}") + end + + context 'with the namespace' do + let(:namespace) { 'namespace_name' } + + subject { described_class.new(rails_env).store(namespace: namespace) } + + it "uses specified namespace" do + expect(subject.to_s).to eq("Redis Client connected to #{host} against DB #{redis_database} with namespace #{namespace}") + end + end + end + + context 'with old format' do + it_behaves_like 'redis store' do + let(:config_file_name) { config_old_format_host } + let(:host) { "localhost:#{redis_port}" } + end + end + + context 'with new format' do + it_behaves_like 'redis store' do + let(:config_file_name) { config_new_format_host } + let(:host) { "development-host:#{redis_port}" } + end + end + end + describe '.params' do subject { described_class.new(rails_env).params } |