Refactor PDF generation spec