Remove method delegation

This commit is contained in:
Pau Perez
2018-09-25 20:57:36 +02:00
parent 54d6bc5443
commit 95ae18a1ba
2 changed files with 2 additions and 18 deletions

View File

@@ -5,7 +5,6 @@
module ProductImport
class EntryProcessor
delegate :products_reset_count, to: :reset_absent
delegate :importing_into_inventory?, to: :settings
attr_reader :inventory_created, :inventory_updated, :products_created, :variants_created, :variants_updated, :supplier_products, :total_supplier_products, :import_settings
@@ -47,7 +46,7 @@ module ProductImport
next unless supplier_id && permission_by_id?(supplier_id)
products_count =
if importing_into_inventory?
if settings.importing_into_inventory?
VariantOverride.where('variant_overrides.hub_id IN (?)', supplier_id).count
else
Spree::Variant.
@@ -78,7 +77,7 @@ module ProductImport
end
def strategy_factory
if importing_into_inventory?
if settings.importing_into_inventory?
InventoryReset
else
ProductsReset

View File

@@ -99,19 +99,4 @@ describe ProductImport::EntryProcessor do
expect(reset_absent).to have_received(:products_reset_count)
end
end
describe '#importing_into_inventory?' do
let(:settings) do
instance_double(ProductImport::Settings, importing_into_inventory?: true)
end
before do
allow(ProductImport::Settings).to receive(:new) { settings }
end
it 'delegates to Settings' do
entry_processor.importing_into_inventory?
expect(settings).to have_received(:importing_into_inventory?)
end
end
end