Remove specs testing filtering of master variants

Master variants are not used in the report
This commit is contained in:
Luis Ramos
2020-06-12 10:56:51 +01:00
parent 6555f8bfba
commit e8417b8be6
2 changed files with 0 additions and 12 deletions

View File

@@ -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?)

View File

@@ -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)