Fix sample data in v2 by setting a Default shipping category in both products and shipping methods

This commit is contained in:
luisramos0
2019-03-17 21:02:24 +00:00
parent 42ee4b9f42
commit 98a262f86e
2 changed files with 3 additions and 2 deletions

View File

@@ -74,8 +74,8 @@ class ProductFactory
variant_unit: "weight",
variant_unit_scale: 1,
unit_value: 1,
on_demand: true
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])
end
end

View File

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