debian-mirror-gitlab/spec/controllers/groups/avatars_controller_spec.rb

31 lines
786 B
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
2015-09-11 14:41:01 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe Groups::AvatarsController do
2019-07-07 11:18:12 +05:30
include ExternalAuthorizationServiceHelpers
2015-09-11 14:41:01 +05:30
let(:user) { create(:user) }
2018-11-08 19:23:39 +05:30
let(:group) { create(:group, avatar: fixture_file_upload("spec/fixtures/dk.png", "image/png")) }
2015-09-11 14:41:01 +05:30
before do
2016-06-02 11:05:42 +05:30
group.add_owner(user)
2015-09-11 14:41:01 +05:30
sign_in(user)
end
2016-09-13 17:45:13 +05:30
it 'removes avatar from DB calling destroy' do
2019-02-15 15:39:39 +05:30
delete :destroy, params: { group_id: group.path }
2015-09-11 14:41:01 +05:30
@group = assigns(:group)
expect(@group.avatar.present?).to be_falsey
expect(@group).to be_valid
end
2019-07-07 11:18:12 +05:30
it 'works when external authorization service is enabled' do
enable_external_authorization_service_check
delete :destroy, params: { group_id: group }
2020-03-13 15:44:24 +05:30
expect(response).to have_gitlab_http_status(:found)
2019-07-07 11:18:12 +05:30
end
2015-09-11 14:41:01 +05:30
end