Test execution of BulkInvoiceService#start_pdf_job

The spec just tested if a job was enqueued, but not if the job can
actually be executed. Unfortunately, this test is quite slow.
This commit is contained in:
Maikel Linke
2019-02-06 11:26:22 +11:00
parent a910468fc7
commit 7c5b430a37

View File

@@ -11,6 +11,17 @@ describe BulkInvoiceService do
expect(Delayed::Job.last.payload_object.method_name).to eq :start_pdf_job_without_delay
end
it "creates a PDF invoice" do
order = create(:completed_order_with_fees)
order.bill_address = order.ship_address
order.save!
service.start_pdf_job([order.id])
Delayed::Job.last.invoke_job
expect(service.invoice_created?(service.id)).to be_truthy
end
end
describe "#invoice_created?" do