require "test_helper" class RegistrationsControllerTest < ActionDispatch::IntegrationTest test "sole admin cannot delete account" do sign_in users(:admin) delete user_registration_path assert_redirected_to edit_user_registration_path assert_equal t("registrations.destroy.sole_admin"), flash[:alert] assert User.exists?(users(:admin).id) end test "non-admin can delete account" do sign_in users(:alice) assert_difference ->{ User.count }, -1 do delete user_registration_path end end end