Replace update_attributes with update

This commit is contained in:
Luis Ramos
2021-05-13 23:04:16 +01:00
committed by Andy Brett
parent f8e5370b0b
commit a1ac4e85ed
4 changed files with 8 additions and 8 deletions

View File

@@ -87,7 +87,7 @@ module Spree
)
refund_transaction_response = provider.refund_transaction(refund_transaction)
if refund_transaction_response.success?
payment.source.update_attributes(
payment.source.update(
refunded_at: Time.now,
refund_transaction_id: refund_transaction_response.RefundTransactionID,
state: "refunded",

View File

@@ -28,7 +28,7 @@ module OrderManagement
let(:payment_method) { create(:payment_method) }
it "returns the pending payment with no change" do
expect(payment).to_not receive(:update_attributes)
expect(payment).to_not receive(:update)
expect(payment_setup.call!).to eq payment
end
end
@@ -38,7 +38,7 @@ module OrderManagement
context "and the card is already set (the payment source is a credit card)" do
it "returns the pending payment with no change" do
expect(payment).to_not receive(:update_attributes)
expect(payment).to_not receive(:update)
expect(payment_setup.call!).to eq payment
end
end
@@ -54,7 +54,7 @@ module OrderManagement
it "adds an error to the order and does not update the payment" do
payment_setup.call!
expect(payment).to_not receive(:update_attributes)
expect(payment).to_not receive(:update)
expect(payment_setup.call!).to eq payment
expect(order.errors[:base].first).to eq "There are no authorised "\
"credit cards available to charge"
@@ -80,7 +80,7 @@ module OrderManagement
it "adds an error to the order and does not update the payment" do
payment_setup.call!
expect(payment).to_not receive(:update_attributes)
expect(payment).to_not receive(:update)
expect(payment_setup.call!).to eq payment
expect(order.errors[:base].first).to eq "There are no authorised "\
"credit cards available to charge"

View File

@@ -291,7 +291,7 @@ describe CheckoutController, type: :controller do
allow(controller).to receive(:current_order).and_return(order)
end
it "returns errors and flash if order.update_attributes fails" do
it "returns errors and flash if order.update fails" do
spree_post :update, format: :json, order: {}
expect(response.status).to eq(400)
expect(response.body).to eq({ errors: assigns[:order].errors, flash: { error: order.errors.full_messages.to_sentence } }.to_json)

View File

@@ -52,7 +52,7 @@ describe 'api/v0/orders', type: :request do
context "and queried by distributor id" do
let(:'q[distributor_id_eq]') { order_dist_2.distributor.id }
before { order_dist_2.distributor.update_attributes owner: user }
before { order_dist_2.distributor.update owner: user }
run_test! do |response|
expect(response).to have_http_status(200)
@@ -119,7 +119,7 @@ describe 'api/v0/orders', type: :request do
order_dist_2.order_cycle.id
}
before { order_dist_2.distributor.update_attributes owner: user }
before { order_dist_2.distributor.update owner: user }
run_test! do |response|
expect(response).to have_http_status(200)