From 73b388da87d5bb27e0bb509af7cf152387901443 Mon Sep 17 00:00:00 2001 From: Kristina Lim Date: Fri, 7 Jun 2019 03:05:12 +0800 Subject: [PATCH] Simplify product import all_entries method --- app/models/product_import/product_importer.rb | 6 +----- spec/models/product_importer_spec.rb | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/models/product_import/product_importer.rb b/app/models/product_import/product_importer.rb index 6d5e864393..b53c80c3f5 100644 --- a/app/models/product_import/product_importer.rb +++ b/app/models/product_import/product_importer.rb @@ -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| diff --git a/spec/models/product_importer_spec.rb b/spec/models/product_importer_spec.rb index f746f2fb4e..6a3a93a19e 100644 --- a/spec/models/product_importer_spec.rb +++ b/spec/models/product_importer_spec.rb @@ -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