Sha256: e9c1e2b801f810c7312ba572cb6067a2efbc9fb31fc56f8d9798bfe006b2745b

Contents?: true

Size: 1.06 KB

Versions: 17

Compression:

Stored size: 1.06 KB

Contents

FactoryBot.define do
  factory :invoice, class: "Comee::Core::Invoice" do
    invoice_no { nil }
    sales_order
    invoice_type { Comee::Core::Invoice::DELIVERY }
    pod
    date_issued { Date.current }
    due_date { Date.current.advance(days: 10) }
    total_price { 0 }
    amount_paid { 0 }
    amount_credited { 0 }
    payment_term { Faker::Lorem.sentence }
    pct_advanced { nil }
    notifications_sent { 0 }
    status { Comee::Core::Invoice.statuses[:draft] }
    payment_status { Comee::Core::Invoice.payment_statuses[:not_paid] }
    association :invoice_address, factory: :client_address, address_type: Comee::Core::ClientAddress::INVOICING_ADDRESS

    trait :approved do
      status { Comee::Core::Invoice.statuses[:approved] }
    end

    trait :issued do
      status { Comee::Core::Invoice.statuses[:issued] }
    end

    trait :advance do
      invoice_type { Comee::Core::Invoice::ADVANCE }
      pod { nil }
      pct_advanced { 25 }
    end

    trait :direct do
      invoice_type { Comee::Core::Invoice::DIRECT }
      pct_advanced { nil }
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
comee_core-0.3.62 spec/factories/comee/core/invoices.rb
comee_core-0.3.61 spec/factories/comee/core/invoices.rb
comee_core-0.3.60 spec/factories/comee/core/invoices.rb
comee_core-0.3.59 spec/factories/comee/core/invoices.rb
comee_core-0.3.58 spec/factories/comee/core/invoices.rb
comee_core-0.3.57 spec/factories/comee/core/invoices.rb
comee_core-0.3.56 spec/factories/comee/core/invoices.rb
comee_core-0.3.55 spec/factories/comee/core/invoices.rb
comee_core-0.3.54 spec/factories/comee/core/invoices.rb
comee_core-0.3.53 spec/factories/comee/core/invoices.rb
comee_core-0.3.51 spec/factories/comee/core/invoices.rb
comee_core-0.3.50 spec/factories/comee/core/invoices.rb
comee_core-0.3.49 spec/factories/comee/core/invoices.rb
comee_core-0.3.48 spec/factories/comee/core/invoices.rb
comee_core-0.3.47 spec/factories/comee/core/invoices.rb
comee_core-0.3.46 spec/factories/comee/core/invoices.rb
comee_core-0.3.45 spec/factories/comee/core/invoices.rb