Sha256: 5a297b4641699b4a9877f7e38b80dd827a8684b9ef0ffe1817b28092a485a0de

Contents?: true

Size: 1.03 KB

Versions: 19

Compression:

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

19 entries across 19 versions & 1 rubygems

Version Path
invoice_printer-2.0.0 test/labels_test.rb
invoice_printer-2.0.0.beta3 test/labels_test.rb
invoice_printer-2.0.0.beta2 test/labels_test.rb
invoice_printer-2.0.0.beta1 test/labels_test.rb
invoice_printer-2.0.0.alpha1 test/labels_test.rb
invoice_printer-1.3.0 test/labels_test.rb
invoice_printer-1.2.0 test/labels_test.rb
invoice_printer-1.2.0.alpha1 test/labels_test.rb
invoice_printer-1.1.0 test/labels_test.rb
invoice_printer-1.1.0.rc1 test/labels_test.rb
invoice_printer-1.0.0 test/labels_test.rb
invoice_printer-1.0.0.rc1 test/labels_test.rb
invoice_printer-0.0.9 test/labels_test.rb
invoice_printer-0.0.8 test/labels_test.rb
invoice_printer-0.0.7 test/labels_test.rb
invoice_printer-0.0.6 test/labels_test.rb
invoice_printer-0.0.5 test/labels_test.rb
invoice_printer-0.0.4 test/labels_test.rb
invoice_printer-0.0.3 test/labels_test.rb