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

Version Path
spree_core-2.3.11 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-2.2.12 lib/spree/testing_support/factories/adjustment_factory.rb
solidus_core-1.0.0.pre lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.0.1 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-2.4.7 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-2.3.10 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.0.0 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-2.4.6 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-2.3.9 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-2.2.11 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-2.2.10 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-2.3.8 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-2.4.5 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.0.0.rc4 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.0.0.rc3 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-2.4.4 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-2.3.7 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.0.0.rc1 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-2.4.3 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-2.2.9 lib/spree/testing_support/factories/adjustment_factory.rb