Sha256: 6fd278040f8268b737e962f45c0ac67207e3033d5e66d1212c3ac19aeb50144e

Contents?: true

Size: 1.27 KB

Versions: 19

Compression:

Stored size: 1.27 KB

Contents

require "rails_helper"

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

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

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

    q
  }

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

  let(:content) {
    generate!
    Yomu.new(quotation.pdf_file.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 quotation" do
    quotation = ::Dorsale::BillingMachine::Quotation.new

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

  describe "attachments" do
    let(:quotation) {
      quotation  = create(:billing_machine_quotation)
      attachment = create(:alexandrie_attachment, attachable: quotation)
      quotation
    }

    it "should build attachments" do
      expect(content).to include "page 1"
      expect(content).to include "page 2"
    end
  end # describe "attachments"
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
dorsale-3.14.2 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.14.1 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.14.0 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.13.0 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.12.0 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.11.0 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.10.3 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.10.2 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.10.1 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.10.0 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.9.8 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.9.7 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.9.6 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.9.5 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.9.4 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.9.3 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.9.2 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.9.1 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb
dorsale-3.9.0 spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb