diff --git a/spec/models/enterprise_spec.rb b/spec/models/enterprise_spec.rb index 940abeecd9..83caa3bcf4 100644 --- a/spec/models/enterprise_spec.rb +++ b/spec/models/enterprise_spec.rb @@ -677,8 +677,8 @@ describe Enterprise do let(:taxon1) { create(:taxon) } let(:taxon2) { create(:taxon) } let(:taxon3) { create(:taxon) } - let(:product1) { create(:simple_product, primary_taxon: taxon1, taxons: [taxon1]) } - let(:product2) { create(:simple_product, primary_taxon: taxon1, taxons: [taxon1, taxon2]) } + let(:product1) { create(:simple_product, primary_taxon: taxon1) } + let(:product2) { create(:simple_product, primary_taxon: taxon2) } let(:product3) { create(:simple_product, primary_taxon: taxon3) } let(:oc) { create(:order_cycle) } let(:ex) { diff --git a/spec/models/spree/classification_spec.rb b/spec/models/spree/classification_spec.rb deleted file mode 100644 index 2724e9d7d6..0000000000 --- a/spec/models/spree/classification_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -module Spree - describe Classification do - let(:product) { create(:simple_product) } - let(:taxon) { create(:taxon) } - - it "won't destroy if classification is the primary taxon" do - classification = Classification.create(taxon: taxon, product: product) - product.update(primary_taxon: taxon) - - expect(classification.destroy).to be false - expect(classification.errors.messages[:base]) - .to eq( - ["Taxon #{taxon.name} is the primary taxon of #{product.name} and cannot be deleted"] - ) - expect(classification.reload).to be - end - end -end diff --git a/spec/models/spree/taxon_spec.rb b/spec/models/spree/taxon_spec.rb index b264fa68db..bb84da1288 100644 --- a/spec/models/spree/taxon_spec.rb +++ b/spec/models/spree/taxon_spec.rb @@ -11,10 +11,10 @@ module Spree let(:t2) { create(:taxon) } describe "finding all supplied taxons" do - let!(:p1) { create(:simple_product, supplier: e, taxons: [t1, t2]) } + let!(:p1) { create(:simple_product, supplier: e, primary_taxon_id: t1.id) } it "finds taxons" do - expect(Taxon.supplied_taxons).to eq(e.id => Set.new(p1.taxons.map(&:id))) + expect(Taxon.supplied_taxons).to eq(e.id => Set.new([t1.id])) end end