mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-07 07:36:58 +00:00
David's first review changes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user