Sha256: bd6a827cb0ef82c4fd84494ae8d11f1d1f4c545201132cfdef9cbe0c7efe7091

Contents?: true

Size: 943 Bytes

Versions: 7

Compression:

Stored size: 943 Bytes

Contents

require "rails_helper"

describe ::Dorsale::BillingMachine::InvoiceSingleVatPdf, pdfs: true do
  before :each do
    ::Dorsale::BillingMachine.vat_mode = :single
  end

  let(:invoice) {
    i = create(:billing_machine_invoice)

    create(:billing_machine_invoice_line,
      :invoice  => i,
      :vat_rate => 19.6,
    )

    i
  }

  let(:generate!) {
    Dorsale::BillingMachine::PdfFileGenerator.(invoice)
    invoice.reload
  }

  let(:content) {
    generate!
    PDF::Reader.new(invoice.pdf_file.path).pages.map(&:text).join("\n")
  }

  it "should display global vat rate" do
    expect(content).to include "TVA 19,60"
    expect(content).to_not include "MONTANT TVA"
    expect(content).to_not include "TVA %"
  end

  it "should work with empty invoice" do
    invoice = ::Dorsale::BillingMachine::Invoice.new

    expect {
      described_class.new(invoice).tap(&:build).render_with_attachments
    }.to_not raise_error
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dorsale-4.0.0 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.20.0 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.19.1 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.19.0 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.18.0 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.17.0 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.16.0 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb