Sha256: 8339c0d68ec9c5c0b3347fbecd2ecbff795f133cc1e3a54c2de463c2b792c087

Contents?: true

Size: 950 Bytes

Versions: 7

Compression:

Stored size: 950 Bytes

Contents

require "rails_helper"

describe ::Dorsale::BillingMachine::InvoiceMultipleVatPdf, pdfs: true do
  before :each do
    ::Dorsale::BillingMachine.vat_mode = :multiple
  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 not display global vat rate" do
    expect(content).to_not include "TVA 19,60 %"
    expect(content).to include "MONTANT TVA"
    expect(content).to 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_multiple_vat_pdf_spec.rb
dorsale-3.20.0 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.19.1 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.19.0 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.18.0 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.17.0 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.16.0 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb