FIX: allow single string values on custom multiple select fields and not just arrays (#14236)

This commit is contained in:
Jean
2021-09-03 09:26:57 -04:00
committed by GitHub
parent 763f48abc7
commit 85c31c73ba
2 changed files with 11 additions and 0 deletions

View File

@@ -1279,6 +1279,16 @@ describe UsersController do
end
end
it "should allow single values and not just arrays" do
expect do
put update_user_url, params: { user_fields: { field_id => 'Axe' } }
end.to change { user.reload.user_fields[field_id] }.from(nil).to('Axe')
expect do
put update_user_url, params: { user_fields: { field_id => %w[Axe Juice Sword] } }
end.to change { user.reload.user_fields[field_id] }.from('Axe').to(%w[Axe Sword])
end
it "shouldn't allow unregistered field values" do
expect do
put update_user_url, params: { user_fields: { field_id => %w[Juice] } }