Sha256: d12f8cc66950a696e90a094d4afdac1332016895365eef7e9d969fcb547e2936
Contents?: true
Size: 751 Bytes
Versions: 122
Compression:
Stored size: 751 Bytes
Contents
FactoryGirl.define do factory :adjustment, class: Spree::Adjustment do association(:adjustable, factory: :order) amount 100.0 label 'Shipping' association(:source, factory: :tax_rate) eligible true end factory :tax_adjustment, class: Spree::Adjustment do association(:adjustable, factory: :line_item) amount 10.0 label 'VAT 5%' association(:source, factory: :tax_rate) eligible true after(:create) do |adjustment| # Set correct tax category, so that adjustment amount is not 0 if adjustment.adjustable.is_a?(Spree::LineItem) adjustment.source.tax_category = adjustment.adjustable.tax_category adjustment.source.save adjustment.update! end end end end
Version data entries
122 entries across 122 versions & 2 rubygems