mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-31 21:37:16 +00:00
Remove specs testing filtering of master variants
Master variants are not used in the report
This commit is contained in:
@@ -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?)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user