summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/chat_name_token_spec.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-11-16 14:56:30 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-11-16 14:56:30 +0100
commitd64183e1fa26ab77107e3a2a20be1fe4df3a1875 (patch)
tree00d7b51545c116ce67bb857fd1003ea381250584 /spec/lib/gitlab/chat_name_token_spec.rb
parentc60437786bfe43344b4a5eb040437f73f37c6396 (diff)
downloadgitlab-ce-d64183e1fa26ab77107e3a2a20be1fe4df3a1875.tar.gz
Add most of specs for chat names
Diffstat (limited to 'spec/lib/gitlab/chat_name_token_spec.rb')
-rw-r--r--spec/lib/gitlab/chat_name_token_spec.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/lib/gitlab/chat_name_token_spec.rb b/spec/lib/gitlab/chat_name_token_spec.rb
new file mode 100644
index 00000000000..8d7e7a99059
--- /dev/null
+++ b/spec/lib/gitlab/chat_name_token_spec.rb
@@ -0,0 +1,39 @@
+require 'spec_helper'
+
+describe Gitlab::ChatNameToken, lib: true 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