debian-mirror-gitlab/spec/lib/gitlab/session_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
630 B
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::Session do
2019-07-31 22:56:46 +05:30
it 'uses the current thread as a data store' do
Thread.current[:session_storage] = { a: :b }
expect(described_class.current).to eq(a: :b)
ensure
Thread.current[:session_storage] = nil
end
describe '#with_session' do
it 'sets session hash' do
described_class.with_session(one: 1) do
expect(described_class.current).to eq(one: 1)
end
end
it 'restores current store after' do
described_class.with_session(two: 2) { }
expect(described_class.current).to eq nil
end
end
end