Heat the olive oil in the pot over medium heat, and then add the onions. Sauté until golden, about 3 to 4 minutes.
Add the mushrooms and garlic, and sauté until the mushrooms soften, about 5 minutes. Add the wine and cook, stirring occasionally, until the liquid reduces by half, about 8 to 10 minutes.
Add the broth and beans. Cover and bring to a simmer, cooking until the beans are tender, about 10 to 15 minutes.
Add the pesto and stir, then fold in the spinach. Cook, stirring, until the spinach wilts, about 2 to 3 minutes. Season with salt and pepper to taste. Serve in bowls with a sprinkling of the cheese.