Sha256: 4c12dbcb45f2c27773beed70f706368e3283a79f665f3aa0468e3f5793f88155
Contents?: true
Size: 855 Bytes
Versions: 22
Compression:
Stored size: 855 Bytes
Contents
require 'test_helper' class ApiClientTest < ActiveSupport::TestCase setup do @client = api_clients(:spy) end test "#authentication_token is the signed id" do assert_match(/^\d+--[\da-f]{40}$/, @client.authentication_token) end test "#authentication_token casted as integer is the client id" do assert_equal @client.id, @client.authentication_token.to_i end test ".authenticate returns nil if the signature is invalid" do assert_nil ApiClient.authenticate("#{@client.id}--foobar") end test ".authenticate returns nil if the api client do not exists" do assert_nil ApiClient.authenticate(ApiClient.new(id: 42).authentication_token) end test ".authenticate returns the matching ApiClient record if the token is valid" do assert_equal @client, ApiClient.authenticate(@client.authentication_token) end end
Version data entries
22 entries across 22 versions & 1 rubygems