Preheat the oven to 200°C, fan setting.
Place a large oven-proof pan over a medium heat and add a drizzle of olive oil. Once warm, add the chopped onion, garlic and a pinch of salt. Mix well and cook for 5-10 minutes until the onion feels soft.
While the onion is cooking, place the gnocchi and chopped green beans in a pan of boiling salted water over a medium heat. Cook for a couple of minutes until the gnocchi starts floating to the surface. At this point, strain the pasta and beans – reserving a little of the pasta water.
Stir the drained gnocchi and green beans through the pan for a couple of minutes until the gnocchi gets a little golden on the outsides.
At this point, stir through the pesto, pine nuts, spinach, half of the grated parmesan, crème fraîche and a squeeze of lemon juice. Mix well and cook for a few minutes until the spinach has wilted and everything has come together.
Sprinkle over the remaining grated parmesan and bake in the oven for 10 minutes until bubbling and golden.