Sha256: 9044a3e4855df326becb7be862ddec447f06d50cf9366935ed9febe622af8b57

Contents?: true

Size: 1.02 KB

Versions: 16

Compression:

Stored size: 1.02 KB

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!
    Yomu.new(invoice.pdf_file.path).text
  }

  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

  describe "empty invoice" do
    let(:invoice) {
      id_card = Dorsale::BillingMachine::IdCard.new
      id_card.save(validate: false)
      invoice = ::Dorsale::BillingMachine::Invoice.create!(id_card: id_card)
    }

    it "should work" do
      expect { generate! }.to_not raise_error
    end
  end # describe "empty invoice"

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dorsale-3.8.1 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.8.0 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.7.8 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.7.7 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.7.6 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.7.5 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.7.4 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.7.2 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.7.1 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.7.0 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.6.1 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.6.0 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.5.2 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.5.1 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.5.0 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb
dorsale-3.4.0 spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb