Fix stock location factory

This commit is contained in:
Luis Ramos
2020-08-23 15:47:12 +01:00
parent cd22361d13
commit 4de4cc642d
2 changed files with 1 additions and 4 deletions

View File

@@ -1,8 +1,5 @@
FactoryBot.define do
factory :stock_location, class: Spree::StockLocation do
# Ensures the name attribute is not assigned after instantiating the default location
transient { name 'default' }
# keeps the test stock_location unique
initialize_with { DefaultStockLocation.find_or_create }

View File

@@ -22,7 +22,7 @@ describe DefaultStockLocation do
describe '.destroy_all' do
it "removes all stock locations named 'default'" do
create(:stock_location, name: 'default')
create(:stock_location)
expect { described_class.destroy_all }
.to change { Spree::StockLocation.count }.to(0)