From 0ad8dcc2c5d067ec5983566e40c94f71bc0f9052 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Fri, 26 Jun 2020 13:06:35 +0200 Subject: [PATCH] Fix payment log entries specs The tight coupling between doesn't give other option but to check the private method is called. The specs successfully stub `log_entries#create` but for some reason the model instance that gets evaluated it's not the stubbed one. --- spec/models/spree/payment_original_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/models/spree/payment_original_spec.rb b/spec/models/spree/payment_original_spec.rb index 2ca0089d9d..7a0367c9b8 100644 --- a/spec/models/spree/payment_original_spec.rb +++ b/spec/models/spree/payment_original_spec.rb @@ -37,7 +37,7 @@ describe Spree::Payment do before(:each) do # So it doesn't create log entries every time a processing method is called - allow(payment.log_entries).to receive(:create) + allow(payment).to receive(:record_response) end context 'validations' do @@ -126,8 +126,8 @@ describe Spree::Payment do end it "should log the response" do - expect(payment.log_entries).to receive(:create).with(:details => anything) payment.authorize! + expect(payment).to have_received(:record_response) end context "when gateway does not match the environment" do @@ -177,8 +177,8 @@ describe Spree::Payment do end it "should log the response" do - payment.log_entries.should_receive(:create).with(:details => anything) payment.purchase! + expect(payment).to have_received(:record_response) end context "when gateway does not match the environment" do @@ -292,8 +292,8 @@ describe Spree::Payment do end it "should log the response" do - payment.log_entries.should_receive(:create).with(:details => anything) payment.void_transaction! + expect(payment).to have_received(:record_response) end context "when gateway does not match the environment" do @@ -374,8 +374,8 @@ describe Spree::Payment do end it "should log the response" do - payment.log_entries.should_receive(:create).with(:details => anything) payment.credit! + expect(payment).to have_received(:record_response) end context "when gateway does not match the environment" do