end
end
- describe "delete/1 when confirmation is pending" do
- setup do
- user = insert(:user, is_confirmed: false)
- {:ok, user: user}
- end
-
- test "deletes user from database when activation required", %{user: user} do
- clear_config([:instance, :account_activation_required], true)
-
- {:ok, job} = User.delete(user)
- {:ok, _} = ObanHelpers.perform(job)
-
- refute User.get_cached_by_id(user.id)
- refute User.get_by_id(user.id)
- end
+ test "delete/1 when confirmation is pending deletes the user" do
+ clear_config([:instance, :account_activation_required], true)
+ user = insert(:user, is_confirmed: false)
- test "deactivates user when activation is not required", %{user: user} do
- clear_config([:instance, :account_activation_required], false)
-
- {:ok, job} = User.delete(user)
- {:ok, _} = ObanHelpers.perform(job)
+ {:ok, job} = User.delete(user)
+ {:ok, _} = ObanHelpers.perform(job)
- assert %{deactivated: true} = User.get_cached_by_id(user.id)
- assert %{deactivated: true} = User.get_by_id(user.id)
- end
+ refute User.get_cached_by_id(user.id)
+ refute User.get_by_id(user.id)
end
test "delete/1 when approval is pending deletes the user" do