diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-12-08 07:40:17 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-12-08 07:40:17 +0000 |
commit | 12d33b883adda7093f0f4b838532871036af3925 (patch) | |
tree | 51d183a8ec1166591392583b58ceaad57ce1377b /spec/models | |
parent | eea671a2a6c0b953922c8f8535c09c16cd00e79f (diff) | |
parent | 116d8cfcfbe26f0bb5c6ac49a841f9555b44cf07 (diff) | |
download | gitlab-ce-12d33b883adda7093f0f4b838532871036af3925.tar.gz |
Merge branch '40754-fix-flash-usage-with-personal-access-token' into 'master'
Fix new personal access token showing up in a flash message
Closes #40754
See merge request gitlab-org/gitlab-ce!15707
Diffstat (limited to 'spec/models')
-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) } |