summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/namespaced_session_store_spec.rb
blob: c0af2ede32ad051c816a06f3854db3d09643f6fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

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

      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