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