diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/models/oauth_access_token_spec.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/models/oauth_access_token_spec.rb')
-rw-r--r-- | spec/models/oauth_access_token_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/oauth_access_token_spec.rb b/spec/models/oauth_access_token_spec.rb index 92e1ae8ac60..fc53d926dd6 100644 --- a/spec/models/oauth_access_token_spec.rb +++ b/spec/models/oauth_access_token_spec.rb @@ -53,4 +53,22 @@ RSpec.describe OauthAccessToken do expect(described_class.matching_token_for(app_one, token.resource_owner, token.scopes)).to be_nil end end + + describe '#expires_in' do + context 'when token has expires_in value set' do + it 'uses the expires_in value' do + token = OauthAccessToken.new(expires_in: 1.minute) + + expect(token.expires_in).to eq 1.minute + end + end + + context 'when token has nil expires_in' do + it 'uses default value' do + token = OauthAccessToken.new(expires_in: nil) + + expect(token.expires_in).to eq 2.hours + end + end + end end |