Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

James Healy's Profile

GitHub User: yob


Comments by James Healy


Ryan's suggested approach makes testing PDFs a breeze.

Create a new unit spec for the OrderPdf class and focus on the #render() method.

As a simple first step, spec that the render() methods returns a string that starts with "%PDF" to make sure it's generating a PDF.

To improve the specs, I'd check the PDF contains the appropriate text.

pdf    =
reader =
page   =

page.should include("order #1")