Sha256: 32bffe3ab55410c06b15caf29820c652c770cdaab03188ab3b9965ec1946ffca

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

require 'test_helper'

class LabelsTest < Minitest::Test
  include InvoicePrinterHelpers

  def test_setting_global_labels
    labels = { provider: 'Default Provider', purchaser: 'Default Purchaser' }
    InvoicePrinter.labels = labels
    invoice = InvoicePrinter::Document.new(**default_document_params)
    rendered_pdf = InvoicePrinter.render(document: invoice)
    pdf_analysis = PDF::Inspector::Text.analyze(rendered_pdf)

    assert_equal true, pdf_analysis.strings.include?('Default Provider')
    assert_equal true, pdf_analysis.strings.include?('Default Purchaser')
  end

  def test_setting_instant_labels
    labels = { provider: 'Current Provider', purchaser: 'Current Purchaser' }
    invoice = InvoicePrinter::Document.new(**default_document_params)
    rendered_pdf = InvoicePrinter.render(document: invoice, labels: labels)
    pdf_analysis = PDF::Inspector::Text.analyze(rendered_pdf)

    assert_equal true, pdf_analysis.strings.include?('Current Provider')
    assert_equal true, pdf_analysis.strings.include?('Current Purchaser')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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