Skip to content

Commit

Permalink
Per review, test on create and update
Browse files Browse the repository at this point in the history
  • Loading branch information
rioug committed Dec 4, 2024
1 parent 4a6e4d4 commit cedf040
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions spec/models/spree/order_contents_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@
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 })
Expand All @@ -181,6 +175,12 @@
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
Expand All @@ -192,6 +192,12 @@
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

0 comments on commit cedf040

Please sign in to comment.