Adapt code coming from master to the new order api with update_order!

This commit is contained in:
Luis Ramos
2021-05-14 19:39:23 +01:00
committed by Andy Brett
parent a1ac4e85ed
commit f7726e552a
3 changed files with 5 additions and 17 deletions

View File

@@ -335,7 +335,7 @@ describe Admin::BulkLineItemsController, type: :controller do
order.finalize!
order.recreate_all_fees!
order.create_tax_charge!
order.update!
order.update_order!
order.payments << create(:payment, payment_method: payment_method, amount: order.total, state: "completed")
allow(controller).to receive(:spree_current_user) { distributor.owner }
@@ -354,7 +354,7 @@ describe Admin::BulkLineItemsController, type: :controller do
expect(order.included_tax_total).to eq 1.22
expect(order.payment_state).to eq "paid"
expect(order).to receive(:update!).at_least(:once).and_call_original
expect(order).to receive(:update_order!).at_least(:once).and_call_original
expect(order).to receive(:create_tax_charge!).at_least(:once).and_call_original
spree_put :update, params
@@ -378,7 +378,7 @@ describe Admin::BulkLineItemsController, type: :controller do
expect(order.included_tax_total).to eq 1.22
expect(order.payment_state).to eq "paid"
expect(order).to receive(:update!).at_least(:once).and_call_original
expect(order).to receive(:update_order!).at_least(:once).and_call_original
expect(order).to receive(:create_tax_charge!).at_least(:once).and_call_original
spree_delete :destroy, params

View File

@@ -204,7 +204,7 @@ describe Api::V0::ShipmentsController, type: :controller do
before do
order.shipments.first.shipping_methods = [shipping_method1, shipping_method2]
order.select_shipping_method(shipping_method1.id)
order.update!
order.update_order!
order.update_columns(
payment_total: 60,
payment_state: "paid"

View File

@@ -531,7 +531,6 @@ describe Spree::Payment do
end
context "#save" do
<<<<<<< HEAD
context "completed payments" do
it "updates order payment total" do
payment = create(:payment, amount: 100, order: order, state: "completed")
@@ -572,19 +571,8 @@ describe Spree::Payment do
expect(order_updater).to receive(:update_shipment_state)
create(:payment, amount: 100, order: order)
end
=======
it "should call order#update_order!" do
gateway.name = 'Gateway'
gateway.distributors << create(:distributor_enterprise)
gateway.save!
order = create(:order)
payment = Spree::Payment.create(amount: 100, order: order, payment_method: gateway)
expect(order).to receive(:update_order!)
payment.save
>>>>>>> 95ea3f27b... Rename order.update! to order.update_order! and adjustment.update! to adjustment.update_adjustment!
end
context "when profiles are supported" do
before do
gateway.stub payment_profiles_supported?: true