mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
test if product's variant is duplicated properly
This commit is contained in:
@@ -74,7 +74,9 @@ describe Spree::Core::ProductDuplicator do
|
||||
before do
|
||||
expect(product).to receive(:dup).and_return(new_product)
|
||||
expect(master_variant).to receive(:dup).and_return(new_master_variant)
|
||||
expect(variant).to receive(:dup).and_return(new_variant)
|
||||
expect(image).to receive(:dup).and_return(new_image)
|
||||
expect(image_variant).to receive(:dup).and_return(new_image_variant)
|
||||
expect(property).to receive(:dup).and_return(new_property)
|
||||
end
|
||||
|
||||
@@ -88,6 +90,7 @@ describe Spree::Core::ProductDuplicator do
|
||||
expect(new_product).to receive(:deleted_at=).with(nil)
|
||||
expect(new_product).to receive(:master=).with(new_master_variant)
|
||||
expect(new_product).to receive(:option_types=).with([])
|
||||
expect(new_product).to receive(:variants=).with([new_variant])
|
||||
|
||||
expect(new_master_variant).to receive(:sku=).with("")
|
||||
expect(new_master_variant).to receive(:deleted_at=).with(nil)
|
||||
@@ -95,9 +98,18 @@ describe Spree::Core::ProductDuplicator do
|
||||
expect(new_master_variant).to receive(:price=).with(master_variant.price)
|
||||
expect(new_master_variant).to receive(:currency=).with(master_variant.currency)
|
||||
|
||||
expect(new_variant).to receive(:sku=).with("")
|
||||
expect(new_variant).to receive(:deleted_at=).with(nil)
|
||||
expect(new_variant).to receive(:images=).with([new_image_variant])
|
||||
expect(new_variant).to receive(:price=).with(variant.price)
|
||||
expect(new_variant).to receive(:currency=).with(variant.currency)
|
||||
|
||||
expect(image).to receive(:attachment_blob)
|
||||
expect(new_image).to receive_message_chain(:attachment, :attach)
|
||||
|
||||
expect(image_variant).to receive(:attachment_blob)
|
||||
expect(new_image_variant).to receive_message_chain(:attachment, :attach)
|
||||
|
||||
expect(new_property).to receive(:created_at=).with(nil)
|
||||
expect(new_property).to receive(:updated_at=).with(nil)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user