Sha256: 3579761efb271e6013843340ca9d3f3c984d7594cc3cd18eb7a6a0c461b50803

Contents?: true

Size: 945 Bytes

Versions: 10

Compression:

Stored size: 945 Bytes

Contents

require "rails_helper"

describe ::Dorsale::BillingMachine::QuotationMultipleVatPdf, pdfs: true do
  before :each do
    ::Dorsale::BillingMachine.vat_mode = :multiple
  end

  let(:quotation) {
    q = create(:billing_machine_quotation)

    create(:billing_machine_quotation_line,
      :quotation => q,
      :vat_rate  => 19.6,
    )

    q
  }

  let(:content) {
    tempfile = Tempfile.new("pdf")
    tempfile.binmode
    tempfile.write(quotation.to_pdf)
    tempfile.flush
    Yomu.new(tempfile.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

  it "should work with empty quotation" do
    id_card = Dorsale::BillingMachine::IdCard.new
    quotation = ::Dorsale::BillingMachine::Quotation.new(id_card: id_card)

    expect {
      quotation.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/quotation_multiple_vat_pdf_spec.rb
dorsale-3.2.0 spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb
dorsale-3.1.7 spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb
dorsale-3.1.6 spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb
dorsale-3.1.5 spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb
dorsale-3.1.4 spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb
dorsale-3.1.3 spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb
dorsale-3.1.2 spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb
dorsale-3.1.1 spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb
dorsale-3.1.0 spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb