diff --git a/spec/components/product_component_spec.rb b/spec/components/product_component_spec.rb index 904ed10fdc..5b5de68af6 100644 --- a/spec/components/product_component_spec.rb +++ b/spec/components/product_component_spec.rb @@ -35,12 +35,6 @@ describe ProductComponent, type: :component do ) ) end - - it "joins the categories' name" do - expect(page.find('.category')).to have_content( - /random 1, random 2/, exact: true, normalize_ws: true - ) - end end describe 'on_hand' do diff --git a/spec/lib/reports/products_and_inventory_report_spec.rb b/spec/lib/reports/products_and_inventory_report_spec.rb index 7337a674bf..a3feb0d5ae 100644 --- a/spec/lib/reports/products_and_inventory_report_spec.rb +++ b/spec/lib/reports/products_and_inventory_report_spec.rb @@ -43,9 +43,8 @@ module Reporting allow(variant).to receive_message_chain(:product, :name).and_return("Product Name") allow(variant).to receive_message_chain(:product, :properties) .and_return [double(name: "property1"), double(name: "property2")] - allow(variant).to receive_message_chain(:product, - :taxons).and_return [double(name: "taxon1"), - double(name: "taxon2")] + allow(variant).to receive_message_chain(:product, :primary_taxon). + and_return double(name: "taxon1") allow(variant).to receive_message_chain(:product, :group_buy_unit_size).and_return(21) allow(subject).to receive(:query_result).and_return [variant] @@ -54,7 +53,7 @@ module Reporting "A city", "Product Name", "property1, property2", - "taxon1, taxon2", + "taxon1", "Variant Name", 100, 21, diff --git a/spec/lib/spree/core/product_duplicator_spec.rb b/spec/lib/spree/core/product_duplicator_spec.rb index b36514c206..2d2d47243b 100644 --- a/spec/lib/spree/core/product_duplicator_spec.rb +++ b/spec/lib/spree/core/product_duplicator_spec.rb @@ -6,7 +6,6 @@ describe Spree::Core::ProductDuplicator do let(:product) do double 'Product', name: "foo", - taxons: [], product_properties: [property], variants: [variant], image: image @@ -68,7 +67,6 @@ describe Spree::Core::ProductDuplicator do it "can duplicate a product" do duplicator = Spree::Core::ProductDuplicator.new(product) expect(new_product).to receive(:name=).with("COPY OF foo") - expect(new_product).to receive(:taxons=).with([]) expect(new_product).to receive(:sku=).with("") expect(new_product).to receive(:product_properties=).with([new_property]) expect(new_product).to receive(:created_at=).with(nil) diff --git a/spec/models/spree/product_spec.rb b/spec/models/spree/product_spec.rb index 0a44698d35..77ad608b74 100644 --- a/spec/models/spree/product_spec.rb +++ b/spec/models/spree/product_spec.rb @@ -703,16 +703,6 @@ module Spree end end - describe "taxons" do - let(:taxon1) { create(:taxon) } - let(:taxon2) { create(:taxon) } - let(:product) { create(:simple_product) } - - it "returns the first taxon as the primary taxon" do - expect(product.taxons).to eq([product.primary_taxon]) - end - end - describe "deletion" do let(:p) { create(:simple_product) } let(:v) { create(:variant, product: p) } diff --git a/spec/models/spree/taxon_spec.rb b/spec/models/spree/taxon_spec.rb index bb84da1288..edbc968585 100644 --- a/spec/models/spree/taxon_spec.rb +++ b/spec/models/spree/taxon_spec.rb @@ -40,12 +40,7 @@ module Spree describe "touches" do let!(:taxon1) { create(:taxon) } let!(:taxon2) { create(:taxon) } - let!(:taxon3) { create(:taxon) } - let!(:product) { create(:simple_product, primary_taxon: taxon1, taxons: [taxon1, taxon2]) } - - it "is touched when a taxon is applied to a product" do - expect{ product.taxons << taxon3 }.to change { taxon3.reload.updated_at } - end + let!(:product) { create(:simple_product, primary_taxon: taxon1) } it "is touched when assignment of primary_taxon on a product changes" do expect do diff --git a/spec/serializers/api/enterprise_shopfront_serializer_spec.rb b/spec/serializers/api/enterprise_shopfront_serializer_spec.rb index a2f4358ce1..8d85719483 100644 --- a/spec/serializers/api/enterprise_shopfront_serializer_spec.rb +++ b/spec/serializers/api/enterprise_shopfront_serializer_spec.rb @@ -12,10 +12,10 @@ describe Api::EnterpriseShopfrontSerializer do let!(:taxon1) { create(:taxon, name: 'Meat') } let!(:taxon2) { create(:taxon, name: 'Veg') } let!(:product) { - create(:product, supplier: producer, primary_taxon: taxon1, taxons: [taxon1, taxon2] ) + create(:product, supplier: producer, primary_taxon: taxon1 ) } let!(:product2) { - create(:product, supplier: producer_hidden, primary_taxon: taxon1, taxons: [taxon1, taxon2] ) + create(:product, supplier: producer_hidden, primary_taxon: taxon2 ) } let(:close_time) { 2.days.from_now } @@ -67,6 +67,5 @@ describe Api::EnterpriseShopfrontSerializer do it "serializes taxons" do expect(serializer.serializable_hash[:taxons]).to be_a ActiveModel::ArraySerializer expect(serializer.serializable_hash[:taxons].to_json).to match 'Meat' - expect(serializer.serializable_hash[:taxons].to_json).to match 'Veg' end end diff --git a/spec/serializers/api/product_serializer_spec.rb b/spec/serializers/api/product_serializer_spec.rb index 3877812a88..5a75de4252 100644 --- a/spec/serializers/api/product_serializer_spec.rb +++ b/spec/serializers/api/product_serializer_spec.rb @@ -28,7 +28,7 @@ describe Api::ProductSerializer do it "serializes various attributes" do expect(serializer.serializable_hash.keys).to eq [ :id, :name, :meta_keywords, :group_buy, :notes, :description, :description_html, - :properties_with_values, :variants, :primary_taxon, :taxons, :image, :supplier + :properties_with_values, :variants, :primary_taxon, :image, :supplier ] end @@ -37,8 +37,4 @@ describe Api::ProductSerializer do expect(serializer.serializable_hash[:properties_with_values]).to include product_property end - - it "serializes taxons" do - expect(serializer.serializable_hash[:taxons]).to eq [id: taxon.id] - end end diff --git a/spec/system/admin/reports_spec.rb b/spec/system/admin/reports_spec.rb index 7681e1e96c..e5c3b6863c 100644 --- a/spec/system/admin/reports_spec.rb +++ b/spec/system/admin/reports_spec.rb @@ -402,8 +402,6 @@ describe ' before do product1.set_property 'Organic', 'NASAA 12345' product2.set_property 'Organic', 'NASAA 12345' - product1.taxons = [taxon] - product2.taxons = [taxon] variant1.on_hand = 10 variant1.update!(sku: "sku1") variant2.on_hand = 20 diff --git a/spec/system/consumer/caching/darkswarm_caching_spec.rb b/spec/system/consumer/caching/darkswarm_caching_spec.rb index c6d559281d..908a4e2b16 100644 --- a/spec/system/consumer/caching/darkswarm_caching_spec.rb +++ b/spec/system/consumer/caching/darkswarm_caching_spec.rb @@ -11,7 +11,7 @@ describe "Darkswarm data caching", caching: true do create(:distributor_enterprise, with_payment_and_shipping: true, is_primary_producer: true) } let!(:product) { - create(:simple_product, supplier: producer, primary_taxon: taxon, taxons: [taxon], + create(:simple_product, supplier: producer, primary_taxon: taxon, properties: [property]) } let!(:order_cycle) { diff --git a/spec/system/consumer/caching/shops_caching_spec.rb b/spec/system/consumer/caching/shops_caching_spec.rb index 75607f8200..50ae90160b 100644 --- a/spec/system/consumer/caching/shops_caching_spec.rb +++ b/spec/system/consumer/caching/shops_caching_spec.rb @@ -53,7 +53,7 @@ describe "Shops caching", caching: true do let!(:property) { create(:property, presentation: "Cached Property") } let!(:property2) { create(:property, presentation: "New Property") } let!(:product) { - create(:product, taxons: [taxon], primary_taxon: taxon, properties: [property]) + create(:product, primary_taxon: taxon, properties: [property]) } let(:exchange) { order_cycle.exchanges.to_enterprises(distributor).outgoing.first } @@ -92,7 +92,6 @@ describe "Shops caching", caching: true do expect(page).to have_content taxon.name expect(page).to have_content property.presentation - product.taxons << taxon2 product.update_attribute(:primary_taxon, taxon2) product.update_attribute(:properties, [property2]) diff --git a/spec/system/consumer/producers_spec.rb b/spec/system/consumer/producers_spec.rb index 67a8d6afe2..36ccd65a47 100644 --- a/spec/system/consumer/producers_spec.rb +++ b/spec/system/consumer/producers_spec.rb @@ -19,10 +19,10 @@ describe ' let(:taxon_veg) { create(:taxon, name: 'Vegetables') } let!(:product1) { - create(:simple_product, supplier: producer1, primary_taxon: taxon_fruit, taxons: [taxon_fruit]) + create(:simple_product, supplier: producer1, primary_taxon: taxon_fruit) } let!(:product2) { - create(:simple_product, supplier: producer2, primary_taxon: taxon_veg, taxons: [taxon_veg]) + create(:simple_product, supplier: producer2, primary_taxon: taxon_veg) } let(:shop) { create(:distributor_enterprise) } diff --git a/spec/system/consumer/shops_spec.rb b/spec/system/consumer/shops_spec.rb index a807c078d8..c67e5969fe 100644 --- a/spec/system/consumer/shops_spec.rb +++ b/spec/system/consumer/shops_spec.rb @@ -146,7 +146,7 @@ describe 'Shops' do let!(:closed_oc) { create(:closed_order_cycle, distributors: [shop], variants: [p_closed.variants.first]) } - let!(:p_closed) { create(:simple_product, primary_taxon: taxon_closed, taxons: [taxon_closed]) } + let!(:p_closed) { create(:simple_product, primary_taxon: taxon_closed) } let(:shop) { create(:distributor_enterprise, with_payment_and_shipping: true) } let(:taxon_closed) { create(:taxon, name: 'Closed') } @@ -154,7 +154,7 @@ describe 'Shops' do let!(:open_oc) { create(:open_order_cycle, distributors: [shop], variants: [p_open.variants.first]) } - let!(:p_open) { create(:simple_product, primary_taxon: taxon_open, taxons: [taxon_open]) } + let!(:p_open) { create(:simple_product, primary_taxon: taxon_open) } let(:taxon_open) { create(:taxon, name: 'Open') } it "shows taxons for open order cycles only" do @@ -207,7 +207,7 @@ describe 'Shops' do end describe "hub producer modal" do - let!(:product) { create(:simple_product, supplier: producer, taxons: [taxon]) } + let!(:product) { create(:simple_product, supplier: producer, primary_taxon: taxon) } let!(:taxon) { create(:taxon, name: 'Fruit') } let!(:order_cycle) { create(