David's first review changes

This commit is contained in:
Gaetan Craig-Riou
2024-06-19 10:45:34 +10:00
parent 3788b33eb0
commit f73745a803
3 changed files with 4 additions and 6 deletions

View File

@@ -57,7 +57,7 @@ module Spree
taxons = {}
Spree::Taxon.
joins(products: { variants: :supplier }).
joins(variants: :supplier).
select('spree_taxons.*, enterprises.id AS enterprise_id').
each do |t|
taxons[t.enterprise_id.to_i] ||= Set.new

View File

@@ -38,10 +38,11 @@ RSpec.describe Enterprise do
end
it "destroys supplied variants upon destroy" do
pending "Variant are soft deletable, see: https://github.com/openfoodfoundation/openfoodnetwork/issues/2971"
supplier = create(:supplier_enterprise)
variant = create(:variant, supplier:)
variant.destroy
supplier.destroy
expect(Spree::Variant.where(id: variant.id)).to be_empty
end

View File

@@ -10,10 +10,6 @@ module Spree
context '#duplicate' do
it 'duplicates product' do
variant = product.variants.first
variant.supplier = create(:supplier_enterprise)
variant.save!
clone = product.duplicate
expect(clone).to be_persisted
@@ -390,6 +386,7 @@ module Spree
it "shows products in supplier" do
s1 = create(:supplier_enterprise)
p1 = create(:product, supplier_id: s1.id)
# We create two variants to let us test we don't get duplicated product
create(:variant, product: p1, supplier: s1)
create(:variant, product: p1, supplier: s1)
s2 = create(:supplier_enterprise)