mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Re-use default stock location in specs
This commit is contained in:
@@ -31,7 +31,7 @@ RSpec.describe Api::V0::ShipmentsController, type: :controller do
|
||||
let(:current_api_user) { build(:admin_user) }
|
||||
let!(:order) { shipment.order }
|
||||
let(:order_ship_address) { create(:address) }
|
||||
let!(:stock_location) { Spree::StockLocation.first || create(:stock_location) }
|
||||
let!(:stock_location) { DefaultStockLocation.find_or_create }
|
||||
let!(:variant) { create(:variant) }
|
||||
let(:params) do
|
||||
{ quantity: 2,
|
||||
|
||||
@@ -26,7 +26,7 @@ FactoryBot.define do
|
||||
variant_unit_name { '' }
|
||||
|
||||
# ensure stock item will be created for this products master
|
||||
before(:create) { create(:stock_location) if Spree::StockLocation.count.zero? }
|
||||
before(:create) { DefaultStockLocation.find_or_create }
|
||||
|
||||
factory :product do
|
||||
transient do
|
||||
|
||||
@@ -11,7 +11,7 @@ FactoryBot.define do
|
||||
state { 'pending' }
|
||||
order
|
||||
address
|
||||
stock_location { Spree::StockLocation.first || create(:stock_location) }
|
||||
stock_location { DefaultStockLocation.find_or_create }
|
||||
|
||||
after(:create) do |shipment, _evalulator|
|
||||
shipment.add_shipping_method(create(:shipping_method), true)
|
||||
@@ -31,7 +31,7 @@ FactoryBot.define do
|
||||
state { 'pending' }
|
||||
order
|
||||
address
|
||||
stock_location { Spree::StockLocation.first || create(:stock_location) }
|
||||
stock_location { DefaultStockLocation.find_or_create }
|
||||
|
||||
trait :shipping_method do
|
||||
transient do
|
||||
|
||||
@@ -23,7 +23,7 @@ FactoryBot.define do
|
||||
product { association :base_product }
|
||||
|
||||
# ensure stock item will be created for this variant
|
||||
before(:create) { create(:stock_location) if Spree::StockLocation.count.zero? }
|
||||
before(:create) { DefaultStockLocation.find_or_create }
|
||||
|
||||
factory :variant do
|
||||
transient do
|
||||
|
||||
Reference in New Issue
Block a user