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/initializers/session_store_spec.rb | |
parent | c6050cf3204ebd5f554870881952aa8e24324269 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/initializers/session_store_spec.rb')
-rw-r--r-- | spec/initializers/session_store_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/initializers/session_store_spec.rb b/spec/initializers/session_store_spec.rb new file mode 100644 index 00000000000..3da52ccc981 --- /dev/null +++ b/spec/initializers/session_store_spec.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Session initializer for GitLab' do + subject { Gitlab::Application.config } + + let(:load_session_store) do + load Rails.root.join('config/initializers/session_store.rb') + end + + describe 'config#session_store' do + context 'when the GITLAB_REDIS_STORE_WITH_SESSION_STORE env is not set' do + before do + stub_env('GITLAB_REDIS_STORE_WITH_SESSION_STORE', nil) + end + + it 'initialized as a redis_store with a proper Redis::Store instance' do + expect(subject).to receive(:session_store).with(:redis_store, a_hash_including(redis_store: kind_of(::Redis::Store))) + + load_session_store + end + end + + context 'when the GITLAB_REDIS_STORE_WITH_SESSION_STORE env is disabled' do + before do + stub_env('GITLAB_REDIS_STORE_WITH_SESSION_STORE', false) + end + + it 'initialized as a redis_store with a proper servers configuration' do + expect(subject).to receive(:session_store).with(:redis_store, a_hash_including(servers: kind_of(Hash))) + + load_session_store + end + end + end +end |