我和詹金斯有这样的麻烦。
我正在尝试使用 RSpec 测试 PDF 生成。
尝试打开最近生成的 PDF 文件时,RSpec 测试失败。(文件保存到 /tmp 目录)
//TEST
pdf_generator = PdfGenerator::InvoicePdf.new(invoice)
pdf_file_path = pdf_generator.to_pdf
我得到错误(仅在詹金斯):
Failures:
1) OrdersController GET show while authorized as customer INVOICE .generate_pdf pdf contains correct text
Failure/Error: pdf_file_path = pdf_generator.to_pdf
Errno::ENOENT:
No such file or directory - /var/lib/jenkins/jobs/TicketCo for Gerrit/workspace/tmp/1371464314.pdf
# ./lib/pdf_generator/invoice_pdf.rb:80:in `to_pdf'
# ./spec/controllers/orders_controller_spec.rb:413:in `block (5 levels) in <top (required)>'
这是方法中的行,它会导致错误:
def to_pdf
Prawn::Document.generate(temp_pdf_file_path)
....
end
有人可以帮我解决这个问题吗?也许我需要更改 Jenkins 的 PDF 路径?