From f2fd426c4ad73f49df3c6493a28545c553ce12ac Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Fri, 17 Jul 2020 16:23:23 +0200 Subject: [PATCH] Fix old Spree specs Given the importance of this code, it doesn't bring me much confidence. Apparently, this specs where using a non-existent state by mistake and this went unnoticed because the payment creation was failing silently in payment/processing.rb. This unearthed the fact that our `#ensure_correct_adjustment` needs the order to be persisted to succeed. --- spec/models/spree/payment_spec.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/spec/models/spree/payment_spec.rb b/spec/models/spree/payment_spec.rb index 9ee488a4c7..43a0a05127 100644 --- a/spec/models/spree/payment_spec.rb +++ b/spec/models/spree/payment_spec.rb @@ -2,11 +2,7 @@ require 'spec_helper' describe Spree::Payment do context 'original specs from Spree' do - let(:order) do - order = Spree::Order.new(:bill_address => Spree::Address.new, - :ship_address => Spree::Address.new) - end - + let(:order) { create(:order) } let(:gateway) do gateway = Spree::Gateway::Bogus.new(:environment => 'test', :active => true) gateway.stub :source_required => true @@ -339,7 +335,7 @@ describe Spree::Payment do context "#credit" do before do - payment.state = 'complete' + payment.state = 'completed' payment.response_code = '123' end