Sha256: d8077d36731db33eaf6eea2128d0c196d8ee50e657a0fb77fa709bb09e36789b

Contents?: true

Size: 753 Bytes

Versions: 4

Compression:

Stored size: 753 Bytes

Contents

FactoryGirl.define do
  factory :base_shipping_method, class: Spree::ShippingMethod do
    zones { |_a| [Spree::Zone.global] }
    name 'UPS Ground'
    code 'UPS_GROUND'
    display_on 'both'

    before(:create) do |shipping_method, _evaluator|
      if shipping_method.shipping_categories.empty?
        shipping_method.shipping_categories << (Spree::ShippingCategory.first || create(:shipping_category))
      end
    end

    factory :shipping_method, class: Spree::ShippingMethod do
      association(:calculator, factory: :shipping_calculator, strategy: :build)
    end

    factory :free_shipping_method, class: Spree::ShippingMethod do
      association(:calculator, factory: :shipping_no_amount_calculator, strategy: :build)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_core-3.4.1 lib/spree/testing_support/factories/shipping_method_factory.rb
spree_core-3.4.0 lib/spree/testing_support/factories/shipping_method_factory.rb
spree_core-3.4.0.rc2 lib/spree/testing_support/factories/shipping_method_factory.rb
spree_core-3.4.0.rc1 lib/spree/testing_support/factories/shipping_method_factory.rb