mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Simplify product import all_entries method
This commit is contained in:
@@ -13,7 +13,7 @@ module ProductImport
|
||||
include ActiveModel::Conversion
|
||||
include ActiveModel::Validations
|
||||
|
||||
attr_reader :updated_ids, :import_settings
|
||||
attr_reader :entries, :updated_ids, :import_settings
|
||||
|
||||
def initialize(file, current_user, import_settings = {})
|
||||
unless file.is_a?(File)
|
||||
@@ -90,10 +90,6 @@ module ProductImport
|
||||
@processor.total_enterprise_products
|
||||
end
|
||||
|
||||
def all_entries
|
||||
@entries
|
||||
end
|
||||
|
||||
def entries_json
|
||||
entries = {}
|
||||
@entries.each do |entry|
|
||||
|
||||
@@ -343,7 +343,7 @@ describe ProductImport::ProductImporter do
|
||||
expect(filter('valid', entries)).to eq 0
|
||||
expect(filter('invalid', entries)).to eq 2
|
||||
|
||||
@importer.all_entries.each do |entry|
|
||||
@importer.entries.each do |entry|
|
||||
expect(entry.errors.messages.values).to include [I18n.t('admin.product_import.model.not_updatable')]
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user