diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/models/personal_access_token_spec.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/models/personal_access_token_spec.rb')
-rw-r--r-- | spec/models/personal_access_token_spec.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/spec/models/personal_access_token_spec.rb b/spec/models/personal_access_token_spec.rb index a3f5eb38511..a39a37b605f 100644 --- a/spec/models/personal_access_token_spec.rb +++ b/spec/models/personal_access_token_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe PersonalAccessToken do +RSpec.describe PersonalAccessToken do subject { described_class } describe '.build' do @@ -165,6 +165,7 @@ describe PersonalAccessToken do let_it_be(:revoked_token) { create(:personal_access_token, revoked: true) } let_it_be(:valid_token_and_notified) { create(:personal_access_token, expires_at: 2.days.from_now, expire_notification_delivered: true) } let_it_be(:valid_token) { create(:personal_access_token, expires_at: 2.days.from_now) } + let_it_be(:long_expiry_token) { create(:personal_access_token, expires_at: '999999-12-31'.to_date) } context 'in one day' do it "doesn't have any tokens" do @@ -187,10 +188,24 @@ describe PersonalAccessToken do expect(described_class.without_impersonation).to contain_exactly(personal_access_token) end end + + describe 'revoke scopes' do + let_it_be(:revoked_token) { create(:personal_access_token, :revoked) } + let_it_be(:non_revoked_token) { create(:personal_access_token, revoked: false) } + let_it_be(:non_revoked_token2) { create(:personal_access_token, revoked: nil) } + + describe '.revoked' do + it { expect(described_class.revoked).to contain_exactly(revoked_token) } + end + + describe '.not_revoked' do + it { expect(described_class.not_revoked).to contain_exactly(non_revoked_token, non_revoked_token2) } + end + end end describe '.simple_sorts' do - it 'includes overriden keys' do + it 'includes overridden keys' do expect(described_class.simple_sorts.keys).to include(*%w(expires_at_asc expires_at_desc)) end end |