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.
This commit is contained in:
Pau Perez
2020-07-17 16:23:23 +02:00
parent 1c026479f5
commit f2fd426c4a

View File

@@ -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