This commit is contained in:
Albert Yi
2018-05-15 14:19:45 -07:00
parent c36efc1f62
commit 8bb890e4d0
4 changed files with 17 additions and 9 deletions

View File

@@ -7,6 +7,16 @@ class ApiKeyTest < ActiveSupport::TestCase
@api_key = ApiKey.generate!(@user)
end
should "regenerate the key" do
assert_changes(-> { @api_key.key }) do
@api_key.regenerate!
end
end
should "generate a unique key" do
assert_not_nil(@api_key.key)
end
should "authenticate via api key" do
assert_not_nil(User.authenticate_api_key(@user.name, @api_key.key))
end