Sha256: 498a067caec869efe379d58e071876333a4f98fbc3aec24168973ea1e06275f0

Contents?: true

Size: 1.6 KB

Versions: 6

Compression:

Stored size: 1.6 KB

Contents

Factory.define(:adjustment) do |record|
  record.amount { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
  record.description { Faker::Lorem.sentence }
  
  # associations: 
  #record.association(:order, :factory => :order)
end

Factory.define(:charge, :class => Charge) do |record|
  record.amount { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
  record.description { Faker::Lorem.sentence }
  record.secondary_type "Charge"

  # associations:
  #record.association(:order, :factory => :order)
end

Factory.define(:shipping_charge, :class => Charge) do |record|
  record.amount { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
  record.description { Faker::Lorem.sentence }
  record.secondary_type "ShippingCharge"

  # associations:
  record.association(:order, :factory => :order)
end

Factory.define(:tax_charge, :class => Charge) do |record|
  record.amount { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
  record.description { Faker::Lorem.sentence }
  record.secondary_type "TaxCharge"

  # associations:
  record.association(:order, :factory => :order)
end

Factory.define(:credit, :class => Credit) do |record|
  record.amount { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
  record.description { Faker::Lorem.sentence }
  record.secondary_type "Credit"

  # associations:
  record.association(:order, :factory => :order)
end

Factory.define(:coupon_credit, :class => Credit) do |f|
  f.amount { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
  f.description { Faker::Lorem.sentence }
  f.secondary_type "Credit"

  # associations:
  f.association(:order, :factory => :order)
  f.association(:adjustment_source, :factory => :coupon)
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
spree-enriquez-0.9.4 test/factories/adjustments_factory.rb
spree-0.9.4 test/factories/adjustments_factory.rb
spree-0.9.3 test/factories/adjustments_factory.rb
spree-0.9.2 test/factories/adjustments_factory.rb
spree-0.9.1 test/factories/adjustments_factory.rb
spree-0.9.0 test/factories/adjustments_factory.rb