diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-12-04 07:01:18 +0300 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2017-12-08 01:22:37 +0300 |
commit | 116d8cfcfbe26f0bb5c6ac49a841f9555b44cf07 (patch) | |
tree | e6483b2318bb2f779813d24a652c0b350d12fd77 /spec | |
parent | e0f84130567dc34edf1ae75fcf595e24991d2fa9 (diff) |
Fix new personal access token showing up in a flash message
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/personal_access_token_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/models/personal_access_token_spec.rb b/spec/models/personal_access_token_spec.rb index 01440b15674..2bb1c49b740 100644 --- a/spec/models/personal_access_token_spec.rb +++ b/spec/models/personal_access_token_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' describe PersonalAccessToken do + subject { described_class } + describe '.build' do let(:personal_access_token) { build(:personal_access_token) } let(:invalid_personal_access_token) { build(:personal_access_token, :invalid) } @@ -45,6 +47,29 @@ describe PersonalAccessToken do end end + describe 'Redis storage' do + let(:user_id) { 123 } + let(:token) { 'abc000foo' } + + before do + subject.redis_store!(user_id, token) + end + + it 'returns stored data' do + expect(subject.redis_getdel(user_id)).to eq(token) + end + + context 'after deletion' do + before do + expect(subject.redis_getdel(user_id)).to eq(token) + end + + it 'token is removed' do + expect(subject.redis_getdel(user_id)).to be_nil + end + end + end + context "validations" do let(:personal_access_token) { build(:personal_access_token) } |