Cook pasta according to instructions. When ready, drain and reserve 1/2 cup of the pasta water.
Heat the olive oil over medium heat in a pan. Fry onions for about 2 minutes, then add chili and anchovy fillets. Cook until anchovy has dissolved, about 3 minutes. Stir occasionally. Stir in beans and the tuna, cook for another few minutes. Add the spinach and cook until it is wilted. Take off the heat. Stir the pasta into the tuna bean mixture, and add pasta water as needed, to make it a little saucier. Serve immediately.