Cook the pasta while preparing the sauce.
Heat the olive oil in a frying pan, add the red onion and mushrooms and fry gently until just golden. Remove from the heat but leave in the pan and set aside.
Blanch the green beans in a large pot of boiling salted water for a few minutes. Strain and run under cold water.
Add the green beans to the red onion and mushrooms in frying pan and re-heat on medium. Add salt and pepper to taste.
Add the ricotta, parmesan cheese and basil to the freshly cooked pasta and mix until well coated. Stir in the green beans, red onion and mushroom mixture.
Serve immediately garnished with freshly grated parmesan cheese and crushed black pepper.