mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-19 04:49:15 +00:00
Store semantic link when importing DFC products
This commit is contained in:
@@ -38,6 +38,9 @@ class SuppliedProductBuilder < DfcBuilder
|
||||
product.supplier = supplier
|
||||
product.ensure_standard_variant
|
||||
product.variants.first
|
||||
end.tap do |variant|
|
||||
link = supplied_product.semanticId
|
||||
variant.semantic_links.new(semantic_id: link) if link.present?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -163,6 +163,10 @@ describe SuppliedProductBuilder do
|
||||
it "creates a new Spree::Product and variant" do
|
||||
expect(imported_variant).to be_a(Spree::Variant)
|
||||
expect(imported_variant.id).to be_nil
|
||||
expect(imported_variant.semantic_links.size).to eq 1
|
||||
|
||||
link = imported_variant.semantic_links[0]
|
||||
expect(link.semantic_id).to eq "https://example.net/tomato"
|
||||
|
||||
imported_product = imported_variant.product
|
||||
expect(imported_product).to be_a(Spree::Product)
|
||||
|
||||
Reference in New Issue
Block a user