Merge pull request #5383 from luisramos0/admin_orders_bug

[Spree 2.1] Fix Update and Calculate Fees button
This commit is contained in:
Luis Ramos
2020-06-02 15:30:16 +01:00
committed by GitHub
2 changed files with 10 additions and 0 deletions

View File

@@ -109,6 +109,8 @@ module Spree
private
def order_params
return params[:order] if params[:order].blank?
params.require(:order).permit(:distributor_id, :order_cycle_id)
end

View File

@@ -46,6 +46,14 @@ describe Spree::Admin::OrdersController, type: :controller do
context "complete order" do
let(:order) { create :completed_order_with_totals }
it "does not throw an error if no order object is given in params" do
params = { id: order }
spree_put :update, params
expect(response.status).to eq 302
end
it "updates distribution charges and redirects to order details page" do
expect_any_instance_of(Spree::Order).to receive(:update_distribution_charge!)