FactoryBot.define do factory :customer_order, class: "Comee::Core::CustomerOrder" do order_number { Faker::Alphanumeric.alpha(number: 8) } order_date { Date.current } client order_terms { Faker::Lorem.sentence } consignee { Faker::Name.name } final_destination { Faker::Address.full_address } final_delivery_date { Faker::Date.between(from: Date.current.advance(days: 20), to: Date.current.advance(months: 2)) } handover_date { final_delivery_date.advance(days: -10) } shipping_date { handover_date.advance(days: 10) } association :shipment_address, factory: :client_address, address_type: Comee::Core::ClientAddress::SHIPPING_ADDRESS association :delivery_address, factory: :client_address, address_type: Comee::Core::ClientAddress::DELIVERY_ADDRESS association :invoice_address, factory: :client_address, address_type: Comee::Core::ClientAddress::INVOICING_ADDRESS status { 0 } consolidator_date { Date.current } voyage_no { Faker::Alphanumeric.alpha(number: 10) } shipping_arrangement { Comee::Core::CustomerOrder::OWN } end end