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

chat_name_token_spec.rb « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8d5702a6b27af320e2d14e9803ca79576efa7598 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::ChatNameToken do
  context 'when using unknown token' do
    let(:token) {}

    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