Sha256: eac616631ce64bd836e8e36815e3262bc1579c14549cf810e1543cb121abe0fa

Contents?: true

Size: 706 Bytes

Versions: 16

Compression:

Stored size: 706 Bytes

Contents

require 'test_helper'

module Workarea
  class User
    class AuthenticationTokenTestCase < TestCase
      setup :set_user

      def set_user
        @user = create_user
      end

      def test_authenticate
        assert(AuthenticationToken.authenticate('asflkjasdflkjas').blank?)

        auth = AuthenticationToken.create!(user: @user)
        assert_equal(auth, AuthenticationToken.authenticate(auth.token))
      end

      def test_expired
        auth = AuthenticationToken.create!(user: @user)
        refute(auth.expired?)

        expired = (Workarea.config.authentication_token_expiration + 1.day).from_now
        travel_to expired

        assert(auth.expired?)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
workarea-api-4.5.6 storefront/test/models/workarea/user/authentication_token_test.rb
workarea-api-storefront-4.5.6 test/models/workarea/user/authentication_token_test.rb
workarea-api-4.5.5 storefront/test/models/workarea/user/authentication_token_test.rb
workarea-api-storefront-4.5.5 test/models/workarea/user/authentication_token_test.rb
workarea-api-4.5.4 storefront/test/models/workarea/user/authentication_token_test.rb
workarea-api-storefront-4.5.4 test/models/workarea/user/authentication_token_test.rb
workarea-api-4.5.3 storefront/test/models/workarea/user/authentication_token_test.rb
workarea-api-storefront-4.5.3 test/models/workarea/user/authentication_token_test.rb
workarea-api-4.5.2 storefront/test/models/workarea/user/authentication_token_test.rb
workarea-api-storefront-4.5.2 test/models/workarea/user/authentication_token_test.rb
workarea-api-4.5.0 storefront/test/models/workarea/user/authentication_token_test.rb
workarea-api-storefront-4.5.0 test/models/workarea/user/authentication_token_test.rb
workarea-api-4.4.7 storefront/test/models/workarea/user/authentication_token_test.rb
workarea-api-storefront-4.4.7 test/models/workarea/user/authentication_token_test.rb
workarea-api-4.4.6 storefront/test/models/workarea/user/authentication_token_test.rb
workarea-api-storefront-4.4.6 test/models/workarea/user/authentication_token_test.rb