mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Make strategies class names more explicit
This commit is contained in:
@@ -74,9 +74,9 @@ module ProductImport
|
||||
|
||||
def reset_stock_strategy_factory
|
||||
if settings.importing_into_inventory?
|
||||
InventoryReset
|
||||
InventoryResetStrategy
|
||||
else
|
||||
ProductsReset
|
||||
ProductsResetStrategy
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module ProductImport
|
||||
class InventoryReset
|
||||
class InventoryResetStrategy
|
||||
attr_reader :supplier_ids
|
||||
|
||||
def initialize(excluded_items_ids)
|
||||
@@ -1,5 +1,5 @@
|
||||
module ProductImport
|
||||
class ProductsReset
|
||||
class ProductsResetStrategy
|
||||
attr_reader :supplier_ids
|
||||
|
||||
def initialize(excluded_items_ids)
|
||||
@@ -73,13 +73,13 @@ describe ProductImport::EntryProcessor do
|
||||
|
||||
context 'when importing into inventory' do
|
||||
let(:reset_stock_strategy) do
|
||||
instance_double(ProductImport::InventoryReset)
|
||||
instance_double(ProductImport::InventoryResetStrategy)
|
||||
end
|
||||
|
||||
before do
|
||||
allow(settings).to receive(:importing_into_inventory?) { true }
|
||||
|
||||
allow(ProductImport::InventoryReset)
|
||||
allow(ProductImport::InventoryResetStrategy)
|
||||
.to receive(:new).with([1]) { reset_stock_strategy }
|
||||
end
|
||||
|
||||
@@ -94,13 +94,13 @@ describe ProductImport::EntryProcessor do
|
||||
|
||||
context 'when not importing into inventory' do
|
||||
let(:reset_stock_strategy) do
|
||||
instance_double(ProductImport::ProductsReset)
|
||||
instance_double(ProductImport::ProductsResetStrategy)
|
||||
end
|
||||
|
||||
before do
|
||||
allow(settings).to receive(:importing_into_inventory?) { false }
|
||||
|
||||
allow(ProductImport::ProductsReset)
|
||||
allow(ProductImport::ProductsResetStrategy)
|
||||
.to receive(:new).with([1]) { reset_stock_strategy }
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe ProductImport::InventoryReset do
|
||||
describe ProductImport::InventoryResetStrategy do
|
||||
let(:inventory_reset) { described_class.new(excluded_items_ids) }
|
||||
|
||||
describe '#<<' do
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe ProductImport::ProductsReset do
|
||||
describe ProductImport::ProductsResetStrategy do
|
||||
let(:products_reset) { described_class.new(excluded_items_ids) }
|
||||
|
||||
describe '#<<' do
|
||||
@@ -18,7 +18,7 @@ module ProductImport
|
||||
end
|
||||
|
||||
let(:reset_stock_strategy) do
|
||||
instance_double(InventoryReset, supplier_ids: [])
|
||||
instance_double(InventoryResetStrategy, supplier_ids: [])
|
||||
end
|
||||
|
||||
it 'returns nil' do
|
||||
@@ -36,7 +36,7 @@ module ProductImport
|
||||
)
|
||||
end
|
||||
|
||||
let(:reset_stock_strategy) { instance_double(ProductsReset) }
|
||||
let(:reset_stock_strategy) { instance_double(ProductsResetStrategy) }
|
||||
|
||||
before do
|
||||
allow(entry_processor)
|
||||
@@ -68,7 +68,7 @@ module ProductImport
|
||||
)
|
||||
end
|
||||
|
||||
let(:reset_stock_strategy) { instance_double(InventoryReset) }
|
||||
let(:reset_stock_strategy) { instance_double(InventoryResetStrategy) }
|
||||
|
||||
before do
|
||||
allow(entry_processor)
|
||||
@@ -94,7 +94,7 @@ module ProductImport
|
||||
)
|
||||
end
|
||||
|
||||
let(:reset_stock_strategy) { instance_double(InventoryReset) }
|
||||
let(:reset_stock_strategy) { instance_double(InventoryResetStrategy) }
|
||||
|
||||
before do
|
||||
allow(entry_processor)
|
||||
|
||||
Reference in New Issue
Block a user