2015-09-11 14:41:01 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Projects::AvatarsController do
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:project) { create(:project, :repository, avatar: fixture_file_upload("spec/fixtures/dk.png", "image/png")) }
|
2015-09-11 14:41:01 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2015-09-11 14:41:01 +05:30
|
|
|
controller.instance_variable_set(:@project, project)
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
it 'GET #show' do
|
|
|
|
get :show, namespace_id: project.namespace.id, project_id: project.id
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(404)
|
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'removes avatar from DB by calling destroy' do
|
2015-09-11 14:41:01 +05:30
|
|
|
delete :destroy, namespace_id: project.namespace.id, project_id: project.id
|
|
|
|
expect(project.avatar.present?).to be_falsey
|
|
|
|
expect(project).to be_valid
|
|
|
|
end
|
|
|
|
end
|