Sha256: 242b16a1d1be2f589e2d6c9854b72d0013497c9e8a770d345c6e0e34e289acf9
Contents?: true
Size: 750 Bytes
Versions: 20
Compression:
Stored size: 750 Bytes
Contents
FactoryBot.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
20 entries across 20 versions & 1 rubygems