Sha256: 8987b30996d662620bf3093047009eefbd51475bb324174bf9c7a4a49b8e7f2c

Contents?: true

Size: 920 Bytes

Versions: 10

Compression:

Stored size: 920 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(:content) {
    tempfile = Tempfile.new("pdf")
    tempfile.binmode
    tempfile.write(invoice.to_pdf)
    tempfile.flush
    Yomu.new(tempfile.path).text
  }

  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
    id_card = Dorsale::BillingMachine::IdCard.new
    invoice = ::Dorsale::BillingMachine::Invoice.new(id_card: id_card)

    expect {
      invoice.to_pdf
    }.to_not raise_error
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dorsale-3.3.0 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.2.0 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.1.7 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.1.6 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.1.5 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.1.4 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.1.3 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.1.2 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.1.1 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb
dorsale-3.1.0 spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb