This is how I do it for CSVs file downloads, you can basically do the same 
thing for PDFs.  Obviously the content disposition would be different 
though.

https://gist.github.com/4138045


 
On Thursday, November 22, 2012 3:31:50 AM UTC-7, Javix wrote:
>
> According the Prawn wiki at 
> https://github.com/prawnpdf/prawn/wiki/Using-Prawn-in-Rails-3, what is 
> the way to test a PDF generation method in the controller spec:
>
> class HelloController < ApplicationController
>    def index
>     output = HelloReport.new.to_pdf
>
>     respond_to do |format|
>       format.pdf do
>         send_data output, :filename => "hello.pdf", 
>                           :type => "application/pdf"
>       end
>     end
>   endend
>
> Thanks
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/rspec/-/DM7RT3f_BTwJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to