To blanch the spinach, plunge into boiling salted water for 2 minutes. Drain, squeeze dry in a cloth, and chop very finely.
Place in a bowl with the ricotta, egg yolks, allspice if using, Parmesan, flour, salt and pepper, and work to a firm dough, adding extra flour if necessary.
Roll the dough into a long sausage shape, 2 cm thick. Cut into segments about 2 cm long and put on a lightly floured surface.
Mix the basil and oil in a small jug.
Bring a large saucepan of salted water to the boil, add the prepared gnocchi and cook for about 2-3 minutes. Drain, divide between 4 heated plates or bowls and dress with basil oil and freshly ground black pepper.