Sha256: 8ae3a03301f165f0281cbdad62f37859efe0d240065eaa8daff3b6c8dd7821e6

Contents?: true

Size: 768 Bytes

Versions: 61

Compression:

Stored size: 768 Bytes

Contents

require "rails_helper"

describe Dorsale::BillingMachine::Quotation::Statistics do
  let(:statistics) {
    Dorsale::BillingMachine::Quotation::Statistics.new(Dorsale::BillingMachine::Quotation.all)
  }

  it "stats should not include canceled quotations" do
    q1 = create(:billing_machine_quotation_line, quantity: 1, unit_price: 10)
    q1.quotation.update!(state: "pending")

    q2 = create(:billing_machine_quotation_line, quantity: 1, unit_price: 10)
    q2.quotation.update!(state: "canceled")

    expect(statistics.total_excluding_taxes).to eq 10
  end

  it "stats should be 0 if no quotations" do
    expect(statistics.total_excluding_taxes).to eq 0
    expect(statistics.vat_amount).to eq 0
    expect(statistics.total_including_taxes).to eq 0
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
dorsale-4.0.0 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.20.0 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.19.1 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.19.0 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.18.0 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.17.0 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.16.0 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.15.0 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.11 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.10 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.9 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.8 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.7 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.6 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.5 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.3 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.2 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.1 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.14.0 spec/services/dorsale/billing_machine/quotation/statistics.rb
dorsale-3.13.0 spec/services/dorsale/billing_machine/quotation/statistics.rb