diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-05 15:13:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-05 15:13:40 +0300 |
commit | 7120254aee218529320c061696a2af530494e6aa (patch) | |
tree | c33bc6d9d7881b7ab22bbe09297b2c49aef9a3a9 /spec/lib/gitlab/namespaced_session_store_spec.rb | |
parent | fc23bd54a1a49003eda83bc2331d9b8b8417a91b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/namespaced_session_store_spec.rb')
-rw-r--r-- | spec/lib/gitlab/namespaced_session_store_spec.rb | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/spec/lib/gitlab/namespaced_session_store_spec.rb b/spec/lib/gitlab/namespaced_session_store_spec.rb index 2c258ce3da6..4e9b35e6859 100644 --- a/spec/lib/gitlab/namespaced_session_store_spec.rb +++ b/spec/lib/gitlab/namespaced_session_store_spec.rb @@ -8,19 +8,28 @@ RSpec.describe Gitlab::NamespacedSessionStore do context 'current session' do subject { described_class.new(key) } - it 'stores data under the specified key' do - Gitlab::Session.with_session({}) do - subject[:new_data] = 123 - - expect(Thread.current[:session_storage][key]).to eq(new_data: 123) - end - end - it 'retrieves data from the given key' do Thread.current[:session_storage] = { key => { existing_data: 123 } } expect(subject[:existing_data]).to eq 123 end + + context 'when namespace key does not exist' do + before do + Thread.current[:session_storage] = {} + end + + it 'does not create namespace key when reading a value' do + expect(subject[:non_existent_key]).to eq(nil) + expect(Thread.current[:session_storage]).to eq({}) + end + + it 'stores data under the specified key' do + subject[:new_data] = 123 + + expect(Thread.current[:session_storage][key]).to eq(new_data: 123) + end + end end context 'passed in session' do |