Sha256: cabdc0e8cd42f005b15f12d8ac2394f96136f778c954efaaf5eb09f6baacfea9

Contents?: true

Size: 974 Bytes

Versions: 6

Compression:

Stored size: 974 Bytes

Contents

require 'test_helper'

class InvoicePrinterTest < Minitest::Test
  include InvoicePrinterHelpers

  def test_render_document
    invoice      = InvoicePrinter::Document.new(**default_document_params)
    rendered_pdf = InvoicePrinter.render(document: invoice)
    pdf_analysis = PDF::Inspector::Text.analyze(rendered_pdf)
    strings      = InvoicePrinter::PDFDocument.new(document: invoice).to_a

    assert_equal strings, pdf_analysis.strings
  end

  def test_render_document_from_json
    invoice           = InvoicePrinter::Document.new(**default_document_params)
    invoice_json      = JSON.parse(invoice.to_json)
    invoice_from_json = InvoicePrinter::Document.from_json(invoice_json)
    rendered_pdf      = InvoicePrinter.render(document: invoice_from_json)
    pdf_analysis      = PDF::Inspector::Text.analyze(rendered_pdf)
    strings           = InvoicePrinter::PDFDocument.new(document: invoice).to_a

    assert_equal strings, pdf_analysis.strings
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
invoice_printer-2.4.0 test/invoice_printer_test.rb
invoice_printer-2.3.0 test/invoice_printer_test.rb
invoice_printer-2.2.0 test/invoice_printer_test.rb
invoice_printer-2.2.0.alpha1 test/invoice_printer_test.rb
invoice_printer-2.1.0 test/invoice_printer_test.rb
invoice_printer-2.1.0.rc1 test/invoice_printer_test.rb