Sha256: 6d7e1a83709a2d35aaaec22b0f5f65a945f1fd9beca9650bec441340ed490820

Contents?: true

Size: 1.39 KB

Versions: 16

Compression:

Stored size: 1.39 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

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

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

  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

16 entries across 16 versions & 1 rubygems

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