mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
Spec fail on bad enterprise param
It looks like some JS component can submit an invalid value here and it causes a server error.
This commit is contained in:
@@ -162,6 +162,30 @@ describe Admin::EnterprisesController, type: :controller do
|
||||
expect(distributor.users).to_not include user
|
||||
end
|
||||
|
||||
it "updates the contact for notifications" do
|
||||
allow(controller).to receive_messages spree_current_user: distributor_manager
|
||||
params = {
|
||||
id: distributor,
|
||||
receives_notifications: distributor_manager.id,
|
||||
}
|
||||
|
||||
expect { spree_post :update, params }.
|
||||
to change { distributor.contact }.to(distributor_manager)
|
||||
end
|
||||
|
||||
it "updates the contact for notifications" do
|
||||
pending "parameter sanitation: https://github.com/openfoodfoundation/openfoodnetwork/issues/8925"
|
||||
|
||||
allow(controller).to receive_messages spree_current_user: distributor_manager
|
||||
params = {
|
||||
id: distributor,
|
||||
receives_notifications: "? object:null ?",
|
||||
}
|
||||
|
||||
expect { spree_post :update, params }.
|
||||
to_not change { distributor.contact }
|
||||
end
|
||||
|
||||
it "updates enterprise preferences" do
|
||||
allow(controller).to receive_messages spree_current_user: distributor_manager
|
||||
update_params = { id: distributor,
|
||||
|
||||
Reference in New Issue
Block a user