2019-04-15 06:17:05 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-05-06 17:33:39 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Groups::AvatarsController do
|
2019-04-09 11:38:58 -04:00
|
|
|
include ExternalAuthorizationServiceHelpers
|
|
|
|
|
2015-05-06 17:33:39 -04:00
|
|
|
let(:user) { create(:user) }
|
2018-06-05 17:18:06 -04:00
|
|
|
let(:group) { create(:group, avatar: fixture_file_upload("spec/fixtures/dk.png", "image/png")) }
|
2015-05-06 17:33:39 -04:00
|
|
|
|
|
|
|
before do
|
2016-03-20 18:09:33 -04:00
|
|
|
group.add_owner(user)
|
2015-05-06 17:33:39 -04:00
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'removes avatar from DB calling destroy' do
|
2018-12-17 17:52:17 -05:00
|
|
|
delete :destroy, params: { group_id: group.path }
|
2015-05-06 17:33:39 -04:00
|
|
|
@group = assigns(:group)
|
|
|
|
expect(@group.avatar.present?).to be_falsey
|
|
|
|
expect(@group).to be_valid
|
|
|
|
end
|
2019-04-09 11:38:58 -04:00
|
|
|
|
|
|
|
it 'works when external authorization service is enabled' do
|
|
|
|
enable_external_authorization_service_check
|
|
|
|
|
|
|
|
delete :destroy, params: { group_id: group }
|
|
|
|
|
2020-02-06 04:09:06 -05:00
|
|
|
expect(response).to have_gitlab_http_status(:found)
|
2019-04-09 11:38:58 -04:00
|
|
|
end
|
2015-05-06 17:33:39 -04:00
|
|
|
end
|