Skip to content

Commit

Permalink
Merge pull request #11853 from dacook/check_pdf_file_bulk_invoice_print2
Browse files Browse the repository at this point in the history
Spec refactor
  • Loading branch information
filipefurtad0 authored Nov 24, 2023
2 parents f2f63eb + eecca8e commit 92686c9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spec/system/admin/orders_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -574,12 +574,12 @@

context "can bulk print invoices" do
def extract_pdf_content
pdf_href = page.all('a').pluck('href')
page.find(class: "button", text: "VIEW FILE").click
invoice_file_number = pdf_href[0][45..59]
invoice_path = "tmp/invoices/#{invoice_file_number}.pdf"
reader = PDF::Reader.new(invoice_path)
# Extract last part of invoice URL
link = page.find(class: "button", text: "VIEW FILE")
filename = link[:href].match %r{/invoices/.*}

# Load invoice temp file directly instead of downloading
reader = PDF::Reader.new("tmp/#{filename}.pdf")
reader.pages.map(&:text)
end

Expand Down

0 comments on commit 92686c9

Please sign in to comment.