Heat the oil in a medium frying pan. Add the onion and fry for 3–4 minutes until softened. Add the beans and spinach and heat gently for 2–3 minutes until the spinach has wilted.
Pour over the eggs, then spoon over the ricotta and season with salt (if liked) and pepper. Cook until almost set, then place under a preheated hot grill and cook for 1–2 minutes until golden and set. Serve with a tomato and red onion salad.