Make OC advanced settings work by permitting the extra parameter

This commit is contained in:
Luis Ramos
2020-07-16 16:31:13 +01:00
parent 3d94ce39dd
commit 0fe9d2ac09
2 changed files with 13 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ module PermittedAttributes
@params.require(:order_cycle).permit(
:name, :orders_open_at, :orders_close_at, :coordinator_id,
:preferred_product_selection_from_coordinator_inventory_only,
incoming_exchanges: permitted_exchange_attributes,
outgoing_exchanges: permitted_exchange_attributes,
schedule_ids: [], coordinator_fee_ids: []

View File

@@ -178,10 +178,22 @@ module Admin
it "returns an error message" do
spree_put :update, params
json_response = JSON.parse(response.body)
expect(json_response['errors']).to be
end
end
it "can update preference product_selection_from_coordinator_inventory_only" do
expect(OrderCycleForm).to receive(:new).
with(order_cycle,
{ "preferred_product_selection_from_coordinator_inventory_only" => true },
anything) { form_mock }
allow(form_mock).to receive(:save) { true }
spree_put :update, params.
merge(order_cycle: { preferred_product_selection_from_coordinator_inventory_only: true })
end
end
end