Skip to content

Commit 5ecd078

Browse files
committed
Add describe block to Shipment#update_amounts test
1 parent 340032c commit 5ecd078

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

core/spec/models/spree/shipment_spec.rb

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -507,14 +507,23 @@
507507
end
508508
end
509509

510-
context "updates cost when selected shipping rate is present" do
511-
let(:shipment) { create(:shipment) }
512-
before { shipment.selected_shipping_rate.update!(cost: 5) }
510+
describe "#update_amounts" do
511+
let(:shipment) { create(:shipment, cost: 3) }
513512

514-
it "updates shipment totals" do
515-
expect {
516-
shipment.update_amounts
517-
}.to change { shipment.cost }.to(5)
513+
context 'when the selected shipping rate cost is different than the current shipment cost' do
514+
before { shipment.selected_shipping_rate.update!(cost: 5) }
515+
516+
it "updates the shipments cost" do
517+
expect {
518+
shipment.update_amounts
519+
}.to change { shipment.reload.cost }.to(5)
520+
end
521+
522+
it 'changes the updated_at column' do
523+
expect {
524+
shipment.update_amounts
525+
}.to change { shipment.reload.updated_at }
526+
end
518527
end
519528
end
520529

0 commit comments

Comments
 (0)