Sha256: cb38f16458301f60d925aabcb1384a69e6d1872bfdd69f561acb839af400d4c5

Contents?: true

Size: 970 Bytes

Versions: 10

Compression:

Stored size: 970 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

10 entries across 10 versions & 1 rubygems

Version Path
invoice_printer-2.0.0 test/invoice_printer_test.rb
invoice_printer-2.0.0.beta3 test/invoice_printer_test.rb
invoice_printer-2.0.0.beta2 test/invoice_printer_test.rb
invoice_printer-2.0.0.beta1 test/invoice_printer_test.rb
invoice_printer-2.0.0.alpha1 test/invoice_printer_test.rb
invoice_printer-1.3.0 test/invoice_printer_test.rb
invoice_printer-1.2.0 test/invoice_printer_test.rb
invoice_printer-1.2.0.alpha1 test/invoice_printer_test.rb
invoice_printer-1.1.0 test/invoice_printer_test.rb
invoice_printer-1.1.0.rc1 test/invoice_printer_test.rb