From e8417b8be606ff048fbb423eaa1d901603c24e53 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Fri, 12 Jun 2020 10:56:51 +0100 Subject: [PATCH] Remove specs testing filtering of master variants Master variants are not used in the report --- .../products_and_inventory_report_base.rb | 1 - .../products_and_inventory_report_spec.rb | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/lib/open_food_network/products_and_inventory_report_base.rb b/lib/open_food_network/products_and_inventory_report_base.rb index d0f4a50de8..c669dc4d6a 100644 --- a/lib/open_food_network/products_and_inventory_report_base.rb +++ b/lib/open_food_network/products_and_inventory_report_base.rb @@ -36,7 +36,6 @@ module OpenFoodNetwork end # Using the `in_stock?` method allows overrides by distributors. - # It also allows the upgrade to Spree 2.0. def filter_on_hand(variants) if params[:report_type] == 'inventory' variants.select(&:in_stock?) diff --git a/spec/lib/open_food_network/products_and_inventory_report_spec.rb b/spec/lib/open_food_network/products_and_inventory_report_spec.rb index e4d4d27142..f0844dfffb 100644 --- a/spec/lib/open_food_network/products_and_inventory_report_spec.rb +++ b/spec/lib/open_food_network/products_and_inventory_report_spec.rb @@ -97,18 +97,7 @@ module OpenFoodNetwork describe "Filtering variants" do let(:variants) { Spree::Variant.where(nil).joins(:product).where(is_master: false) } - it "should return unfiltered variants sans-params" do - product1 = create(:simple_product, supplier: supplier) - product2 = create(:simple_product, supplier: supplier) - expect(subject.filter(Spree::Variant.where(nil))).to match_array [product1.master, product1.variants.first, product2.master, product2.variants.first] - end - it "should filter deleted products" do - product1 = create(:simple_product, supplier: supplier) - product2 = create(:simple_product, supplier: supplier) - product2.destroy - expect(subject.filter(Spree::Variant.where(nil))).to match_array [product1.master, product1.variants.first] - end describe "based on report type" do it "returns only variants on hand" do product1 = create(:simple_product, supplier: supplier, on_hand: 99)