mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Merge pull request #5383 from luisramos0/admin_orders_bug
[Spree 2.1] Fix Update and Calculate Fees button
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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!)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user