From 5be1b139b93d031dcee14bd0849eb9b789efbec9 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Tue, 15 Feb 2022 12:19:15 +0000 Subject: [PATCH] Replace .stub with expect(x).to receive(:y) The #stub method is slightly deprecated syntax. Using #expect has the additional benefit here of failing if the object does not receive the expected method call. --- spec/models/spree/payment_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/models/spree/payment_spec.rb b/spec/models/spree/payment_spec.rb index 0627e811b8..ac5600d9be 100644 --- a/spec/models/spree/payment_spec.rb +++ b/spec/models/spree/payment_spec.rb @@ -407,8 +407,8 @@ describe Spree::Payment do context "if payment method has any payment fees" do before do - payment.order.stub outstanding_balance: 10 - payment.stub credit_allowed: 200 + expect(payment.order).to receive(:outstanding_balance).at_least(:once) { 10 } + expect(payment).to receive(:credit_allowed) { 200 } end it "should not applied any transaction fees" do