Merge pull request #3634 from luisramos0/2-0-fix-sample-data

[Spree Upgrade] Fix new sample data in v2
This commit is contained in:
Luis Ramos
2019-04-11 23:07:15 +01:00
committed by GitHub
2 changed files with 6 additions and 3 deletions

View File

@@ -74,8 +74,10 @@ class ProductFactory
variant_unit: "weight",
variant_unit_scale: 1,
unit_value: 1,
on_demand: true
shipping_category: Spree::ShippingCategory.find_or_create_by_name('Default')
)
Spree::Product.create_with(params).find_or_create_by_name!(params[:name])
product = Spree::Product.create_with(params).find_or_create_by_name!(params[:name])
product.variants.first.update_attribute :on_demand, true
product
end
end

View File

@@ -47,7 +47,8 @@ class ShippingMethodFactory
def create_shipping_method(enterprise, params)
params[:distributor_ids] = [enterprise.id]
method = enterprise.shipping_methods.new(params)
method.zone = zone
method.zones << zone
method.shipping_categories << Spree::ShippingCategory.find_or_create_by_name('Default')
method.save!
method
end