Replace expecting method call with outcome

This is more realistic and robust. Don't mock the class under test (even
though `touch` is actually provided by Active Record).
This commit is contained in:
Maikel Linke
2024-07-02 13:19:39 +10:00
parent eea227bc22
commit 94d560d341

View File

@@ -220,8 +220,12 @@ RSpec.describe Spree::Order do
subject(:order) { Spree::Order.create }
it "should set completed_at" do
expect(order).to receive(:touch).with(:completed_at)
order.finalize!
expect {
order.finalize!
order.reload
}.to change {
order.completed_at
}.from(nil)
end
it "should sell inventory units" do