Sha256: d1b8769afab2a3759f3e0d6acc18cf68e9e2b7694bdcf88f5ade93104dca2761
Contents?: true
Size: 1.88 KB
Versions: 2
Compression:
Stored size: 1.88 KB
Contents
FactoryGirl.define do sequence :user_authentication_token do |n| "xxxx#{Time.current.to_i}#{rand(1000)}#{n}xxxxxxxxxxxxx" end factory :purchase_order, class: Spree::PurchaseOrder do po_number 'PO-123' organization_name 'Spree Commerce' association(:payment_method, factory: :purchase_order_payment_method) end factory :purchase_order_payment_method, class: Spree::PaymentMethod::PurchaseOrder do name 'Purchase Order' end factory :payment, class: Spree::Payment do amount 45.75 association(:source, factory: :purchase_order) association(:payment_method, factory: :purchase_order_payment_method) order state 'checkout' response_code '12345' end factory :order, class: Spree::Order do bill_address completed_at nil email { 'email@example.com' } transient do line_items_price BigDecimal.new(10) end end factory :state, class: Spree::State do sequence(:name) { |n| "STATE_NAME_#{n}" } sequence(:abbr) { |n| "STATE_ABBR_#{n}" } country do |country| if usa = Spree::Country.find_by_numcode(840) country = usa else country.association(:country) end end end factory :country, class: Spree::Country do sequence(:iso_name) { |n| "ISO_NAME_#{n}" } sequence(:name) { |n| "NAME_#{n}" } iso 'US' iso3 'USA' numcode 840 end factory :address, aliases: [:bill_address, :ship_address], class: Spree::Address do firstname 'John' lastname 'Doe' company 'Company' address1 '10 Lovely Street' address2 'Northwest' city 'Herndon' zipcode '35005' phone '555-555-0199' alternative_phone '555-555-0199' state { |address| address.association(:state) || Spree::State.last } country do |address| if address.state address.state.country else address.association(:country) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree_purchase_order-2.2.0 | spec/factories/purchase_orders.rb |
spree_purchase_order-2.3.0 | spec/factories/purchase_orders.rb |