Skip to content
This repository has been archived by the owner on Dec 11, 2021. It is now read-only.

Commit

Permalink
Token is expired if 'expired_at' time is now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Stevens authored and jirutka committed Nov 9, 2015
1 parent 0e56a0c commit 13753d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/oauth2/access_token.rb
Expand Up @@ -70,7 +70,7 @@ def expires?
#
# @return [Boolean]
def expired?
expires? && (expires_at < Time.now.to_i)
expires? && (expires_at <= Time.now.to_i)
end

# Refreshes the current Access Token
Expand Down
7 changes: 7 additions & 0 deletions spec/oauth2/access_token_spec.rb
Expand Up @@ -133,6 +133,13 @@ def assert_initialized_token(target)
expect(access).to be_expired
end

it 'is true if expires_at is now' do
@now = Time.now
access = AccessToken.new(client, token, :refresh_token => 'abaca', :expires_at => @now.to_i)
allow(Time).to receive(:now).and_return(@now)
expect(access).to be_expired
end

end

describe '#refresh!' do
Expand Down

0 comments on commit 13753d6

Please sign in to comment.