FEATURE: Check if selectable avatars exist before enabling them (#10032)

This commit is contained in:
Bianca Nenciu
2020-06-22 16:58:26 +03:00
committed by GitHub
parent 685646540a
commit 68f767a557
6 changed files with 53 additions and 7 deletions

View File

@ -2290,19 +2290,18 @@ describe UsersController do
context 'selectable avatars is enabled' do
before { SiteSetting.selectable_avatars_enabled = true }
before do
SiteSetting.selectable_avatars = [avatar1.url, avatar2.url].join("\n")
SiteSetting.selectable_avatars_enabled = true
end
it 'raises an error when selectable avatars is empty' do
SiteSetting.selectable_avatars = ""
put "/u/#{user.username}/preferences/avatar/select.json", params: { url: url }
expect(response.status).to eq(422)
end
context 'selectable avatars is properly setup' do
before do
SiteSetting.selectable_avatars = [avatar1.url, avatar2.url].join("\n")
end
it 'raises an error when url is not in selectable avatars list' do
put "/u/#{user.username}/preferences/avatar/select.json", params: { url: url }
expect(response.status).to eq(422)