feat: Ability to update avatars from super admin (#7264)
- Ability to update user avatars from super admin - Ability to update bot avatars from super admin fixes: #7060
This commit is contained in:
@@ -22,4 +22,25 @@ RSpec.describe 'Super Admin agent-bots API', type: :request do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'DELETE /super_admin/agent_bots/:id/destroy_avatar' do
|
||||
let!(:agent_bot) { create(:agent_bot, :with_avatar) }
|
||||
|
||||
context 'when it is an unauthenticated super admin' do
|
||||
it 'returns unauthorized' do
|
||||
delete "/super_admin/agent_bots/#{agent_bot.id}/avatar", params: { attachment_id: agent_bot.avatar.id }
|
||||
expect(response).to have_http_status(:redirect)
|
||||
expect(agent_bot.reload.avatar).to be_attached
|
||||
end
|
||||
end
|
||||
|
||||
context 'when it is an authenticated super admin' do
|
||||
it 'destroys the avatar' do
|
||||
sign_in(super_admin, scope: :super_admin)
|
||||
delete "/super_admin/agent_bots/#{agent_bot.id}/avatar", params: { attachment_id: agent_bot.avatar.id }
|
||||
expect(response).to have_http_status(:redirect)
|
||||
expect(agent_bot.reload.avatar).not_to be_attached
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user