mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
Fix params issues in OrderCyclescontroller spec
This commit is contained in:
@@ -199,10 +199,12 @@ module Admin
|
||||
end
|
||||
|
||||
def remove_protected_attrs
|
||||
params[:order_cycle].delete :coordinator_id
|
||||
return unless order_cycle_params[:order_cycle]
|
||||
|
||||
order_cycle_params[:order_cycle].delete :coordinator_id
|
||||
|
||||
unless Enterprise.managed_by(spree_current_user).include?(@order_cycle.coordinator)
|
||||
params[:order_cycle].delete_if do |k, _v|
|
||||
order_cycle_params[:order_cycle].delete_if do |k, _v|
|
||||
[:name, :orders_open_at, :orders_close_at].include? k.to_sym
|
||||
end
|
||||
end
|
||||
@@ -238,7 +240,7 @@ module Admin
|
||||
end
|
||||
|
||||
def order_cycle_params
|
||||
PermittedAttributes::OrderCycle.new(params).call
|
||||
@order_cycle_params ||= PermittedAttributes::OrderCycle.new(params).call.to_h.with_indifferent_access
|
||||
end
|
||||
|
||||
def order_cycle_bulk_params
|
||||
|
||||
@@ -187,7 +187,7 @@ module Admin
|
||||
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 },
|
||||
{ "preferred_product_selection_from_coordinator_inventory_only" => "true" },
|
||||
anything) { form_mock }
|
||||
allow(form_mock).to receive(:save) { true }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user