mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Per review, test on create and update
This commit is contained in:
@@ -166,12 +166,6 @@ RSpec.describe Spree::OrderContents do
|
||||
end
|
||||
|
||||
describe "#update_or_create" do
|
||||
it "ensures shipments are updated" do
|
||||
expect(order).to receive(:ensure_updated_shipments)
|
||||
|
||||
subject.update_or_create(variant, { quantity: 2, max_quantity: 3 })
|
||||
end
|
||||
|
||||
describe "creating" do
|
||||
it "creates a new line item with given attributes" do
|
||||
subject.update_or_create(variant, { quantity: 2, max_quantity: 3 })
|
||||
@@ -181,6 +175,12 @@ RSpec.describe Spree::OrderContents do
|
||||
expect(line_item.max_quantity).to eq 3
|
||||
expect(line_item.price).to eq variant.price
|
||||
end
|
||||
|
||||
it "ensures shipments are updated" do
|
||||
expect(order).to receive(:ensure_updated_shipments)
|
||||
|
||||
subject.update_or_create(variant, { quantity: 2, max_quantity: 3 })
|
||||
end
|
||||
end
|
||||
|
||||
describe "updating" do
|
||||
@@ -192,6 +192,12 @@ RSpec.describe Spree::OrderContents do
|
||||
expect(line_item.reload.quantity).to eq 3
|
||||
expect(line_item.max_quantity).to eq 4
|
||||
end
|
||||
|
||||
it "ensures shipments are updated" do
|
||||
expect(order).to receive(:ensure_updated_shipments)
|
||||
|
||||
subject.update_or_create(variant, { quantity: 3, max_quantity: 4 })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user