Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2019-07-05 11:08:24 +0300
committerBob Van Landuyt <bob@gitlab.com>2019-07-05 11:08:24 +0300
commit2fec78ead4ce46b9728be02693b6e50cce740726 (patch)
tree21273ab81ccc563571da6b5705fe4b1bb1c4e9c5 /spec
parent2e74680358353ee8b258adf2ca1cda422389fc89 (diff)
parentb9b3ec83540a82fc96ddd64715a51d7adeb7312c (diff)
Merge branch 'if-6990-enforce_smartcard_session_for_git_and_api' into 'master'
CE port of "Require session with smartcard login for Git access" See merge request gitlab-org/gitlab-ce!30384
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/namespaced_session_store_spec.rb30
1 files changed, 22 insertions, 8 deletions
diff --git a/spec/lib/gitlab/namespaced_session_store_spec.rb b/spec/lib/gitlab/namespaced_session_store_spec.rb
index c0af2ede32a..e177c44ad67 100644
--- a/spec/lib/gitlab/namespaced_session_store_spec.rb
+++ b/spec/lib/gitlab/namespaced_session_store_spec.rb
@@ -4,19 +4,33 @@ require 'spec_helper'
describe Gitlab::NamespacedSessionStore do
let(:key) { :some_key }
- subject { described_class.new(key) }
- it 'stores data under the specified key' do
- Gitlab::Session.with_session({}) do
- subject[:new_data] = 123
+ context 'current session' do
+ subject { described_class.new(key) }
- expect(Thread.current[:session_storage][key]).to eq(new_data: 123)
+ 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
end
- it 'retrieves data from the given key' do
- Thread.current[:session_storage] = { key => { existing_data: 123 } }
+ context 'passed in session' do
+ let(:data) { { 'data' => 42 } }
+ let(:session) { { 'some_key' => data } }
+
+ subject { described_class.new(key, session.with_indifferent_access) }
- expect(subject[:existing_data]).to eq 123
+ it 'retrieves data from the given key' do
+ expect(subject['data']).to eq 42
+ end
end
end