mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Bring tax category factory from spree_core and fix a problem with the stock location of the product factory
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
require 'ffaker'
|
||||
|
||||
FactoryBot.define do
|
||||
sequence(:random_string) { Faker::Lorem.sentence }
|
||||
sequence(:random_description) { Faker::Lorem.paragraphs(1 + Kernel.rand(5)).join("\n") }
|
||||
sequence(:random_email) { Faker::Internet.email }
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ FactoryBot.define do
|
||||
shipping_category { DefaultShippingCategory.find_or_create }
|
||||
|
||||
# ensure stock item will be created for this products master
|
||||
before(:create) { create(:stock_location) if Spree::StockLocation.count == 0 }
|
||||
before(:create) { DefaultStockLocation.find_or_create }
|
||||
|
||||
factory :product do
|
||||
transient do
|
||||
|
||||
6
spec/factories/tax_category_factory.rb
Normal file
6
spec/factories/tax_category_factory.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
FactoryBot.define do
|
||||
factory :tax_category, class: Spree::TaxCategory do
|
||||
name { "TaxCategory - #{rand(999999)}" }
|
||||
description { generate(:random_string) }
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user