access_token_spec.rb revision 4de867f5bf046eb83029341a4b6520c7cac42274
require 'spec_helper'
let(:access_token) { create :access_token }
before do
repository.access_tokens << access_token
repository.save
end
context 'expired?' do
it 'should not be expired when the expiration date is in the future' do
expect(access_token.expired?).to be_falsy
end
it 'should be expired when the expiration date is in the past' do
access_token.expiration = (-1).minutes.from_now
expect(access_token.expired?).to be_truthy
end
end
context 'to_s' do
it 'should have 2*LENGTH characters' do
expect(access_token.to_s.length).to eq(2*AccessToken::LENGTH)
end
end
end