Bring tax category factory from spree_core and fix a problem with the stock location of the product factory

This commit is contained in:
Luis Ramos
2020-08-23 14:15:20 +01:00
parent 6d05de742e
commit 6d9250c014
3 changed files with 8 additions and 1 deletions

View File

@@ -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 }

View File

@@ -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

View 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