2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::ChatNameToken do
|
2017-08-17 22:00:37 +05:30
|
|
|
context 'when using unknown token' do
|
2022-08-27 11:52:29 +05:30
|
|
|
let(:token) {}
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
subject { described_class.new(token).get }
|
|
|
|
|
|
|
|
it 'returns empty data' do
|
|
|
|
is_expected.to be_nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when storing data' do
|
|
|
|
let(:data) { { key: 'value' } }
|
|
|
|
|
|
|
|
subject { described_class.new(@token) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
@token = described_class.new.store!(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns stored data' do
|
|
|
|
expect(subject.get).to eq(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'and after deleting them' do
|
|
|
|
before do
|
|
|
|
subject.delete
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'data are removed' do
|
|
|
|
expect(subject.get).to be_nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|