Moved common spec code into a shared context.