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