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-3.1.14 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.1.13 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.3.4 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.2.7 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.1.12 lib/spree/testing_support/factories/adjustment_factory.rb
solidus_core-1.1.4 lib/spree/testing_support/factories/adjustment_factory.rb
solidus_core-1.0.7 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.3.3 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.2.6 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.1.11 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.4.1 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.4.0 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.4.0.rc2 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.1.10 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.4.0.rc1 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.3.2 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.2.5 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.1.9 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.3.1 lib/spree/testing_support/factories/adjustment_factory.rb
spree_core-3.2.4 lib/spree/testing_support/factories/adjustment_factory.rb