From e4a49f5d02c8d3e2d06f3ad0ddfdcdef6e2a4f3c Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Mon, 7 Aug 2023 15:31:53 +0100 Subject: [PATCH] Update product duplication --- lib/spree/core/product_duplicator.rb | 1 - spec/models/spree/product_spec.rb | 22 +--------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/lib/spree/core/product_duplicator.rb b/lib/spree/core/product_duplicator.rb index 2c76e519f9..40d1103165 100644 --- a/lib/spree/core/product_duplicator.rb +++ b/lib/spree/core/product_duplicator.rb @@ -20,7 +20,6 @@ module Spree def duplicate_product product.dup.tap do |new_product| new_product.name = "COPY OF #{product.name}" - new_product.taxons = product.taxons new_product.sku = "" new_product.created_at = nil new_product.deleted_at = nil diff --git a/spec/models/spree/product_spec.rb b/spec/models/spree/product_spec.rb index d6a493a89f..0a44698d35 100644 --- a/spec/models/spree/product_spec.rb +++ b/spec/models/spree/product_spec.rb @@ -9,10 +9,6 @@ module Spree let(:product) { create(:product) } context '#duplicate' do - before do - allow(product).to receive_messages taxons: [create(:taxon)] - end - it 'duplicates product' do clone = product.duplicate expect(clone.name).to eq 'COPY OF ' + product.name @@ -170,7 +166,7 @@ module Spree end it "requires a primary taxon" do - expect(build(:simple_product, taxons: [], primary_taxon: nil)).not_to be_valid + expect(build(:simple_product, primary_taxon: nil)).not_to be_valid end it "requires a unit value" do @@ -316,22 +312,6 @@ module Spree end end - it "adds the primary taxon to the product's taxon list" do - taxon = create(:taxon) - product = create(:product, primary_taxon: taxon) - - expect(product.taxons).to include(taxon) - end - - it "removes the previous primary taxon from the taxon list" do - original_taxon = create(:taxon) - product = create(:product, primary_taxon: original_taxon) - product.primary_taxon = create(:taxon) - product.save! - - expect(product.taxons).not_to include(original_taxon) - end - it "updates units when saved change to variant unit" do product.variant_unit = 'items' product.variant_unit_scale = nil