Sha256: 6c106b8dd2fded056888d83718524707e554e136eed3047c2e22322b2fae7d4a

Contents?: true

Size: 609 Bytes

Versions: 2

Compression:

Stored size: 609 Bytes

Contents

require 'spec_helper'

describe Lifen::Token do

  describe 'expired token' do

    let(:expired_token)   { Lifen::Token.new(value: "valid_token", expires_at: Time.now.to_i - 60) }

    it 'refreshs the token' do
      expect(expired_token).to receive(:refresh) do
        expired_token.expires_at = Time.now.to_i + 60
      end

      expired_token.refresh_once_if_needed
    end

  end

  describe 'invalid token' do

    let(:invalid_token)   { Lifen::Token.new(value: "", expires_at: Time.now.to_i + 60) }

    it 'detects invalid tokens' do
      expect(invalid_token).to_not be_valid
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lifen-1.0.2 spec/token_spec.rb
lifen-1.0.1 spec/token_spec.rb