Sha256: 2cb4082d5283cea92cda74262dc99bc081d9860db8239c969721b0c4cdb3405f

Contents?: true

Size: 1.09 KB

Versions: 42

Compression:

Stored size: 1.09 KB

Contents

Spree::Sample.load_sample('addresses')

orders = []
orders << Spree::Order.where(
  number: 'R123456789',
  email: 'spree@example.com'
).first_or_create! do |order|
  order.item_total = 150.95
  order.adjustment_total = 150.95
  order.total = 301.90
end

orders << Spree::Order.where(
  number: 'R987654321',
  email: 'spree@example.com'
).first_or_create! do |order|
  order.item_total = 15.95
  order.adjustment_total = 15.95
  order.total = 31.90
  order.shipping_address = Spree::Address.first
  order.billing_address = Spree::Address.last
end

unless orders[0].line_items.any?
  orders[0].line_items.new(
    variant: Spree::Product.find_by!(name: 'Ruby on Rails Tote').master,
    quantity: 1,
    price: 15.99
  ).save!
end

unless orders[1].line_items.any?
  orders[1].line_items.new(
    variant: Spree::Product.find_by!(name: 'Ruby on Rails Bag').master,
    quantity: 1,
    price: 22.99
  ).save!
end

orders.each(&:create_proposed_shipments)

store = Spree::Store.default

orders.each do |order|
  order.state = 'complete'
  order.store = store
  order.completed_at = Time.current - 1.day
  order.save!
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
spree_sample-4.0.0.rc3 db/samples/orders.rb
spree_sample-3.7.6 db/samples/orders.rb
spree_sample-3.7.5 db/samples/orders.rb
spree_sample-4.0.0.rc2 db/samples/orders.rb
spree_sample-4.0.0.rc1 db/samples/orders.rb
spree_sample-4.0.0.beta db/samples/orders.rb
spree_sample-3.7.4 db/samples/orders.rb
spree_sample-3.7.3 db/samples/orders.rb
spree_sample-3.7.2 db/samples/orders.rb
spree_sample-3.7.1 db/samples/orders.rb
spree_sample-3.7.0 db/samples/orders.rb
spree_sample-3.7.0.rc3 db/samples/orders.rb
spree_sample-3.7.0.rc2 db/samples/orders.rb
spree_sample-3.7.0.rc1 db/samples/orders.rb
spree_sample-3.6.6 db/samples/orders.rb
spree_sample-3.6.5 db/samples/orders.rb
spree_sample-3.6.4 db/samples/orders.rb
spree_sample-3.6.3 db/samples/orders.rb
spree_sample-3.6.2 db/samples/orders.rb
spree_sample-3.6.1 db/samples/orders.rb