diff options
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 |