2019-04-15 06:17:05 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-02-21 16:37:00 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-02-28 12:49:32 -05:00
|
|
|
describe Projects::Settings::RepositoryController do
|
2017-03-01 11:15:46 -05:00
|
|
|
let(:project) { create(:project_empty_repo, :public) }
|
2017-02-21 16:37:00 -05:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2017-02-21 16:37:00 -05:00
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET show' do
|
|
|
|
it 'renders show with 200 status code' do
|
2018-12-17 17:52:17 -05:00
|
|
|
get :show, params: { namespace_id: project.namespace, project_id: project }
|
2017-02-21 16:37:00 -05:00
|
|
|
|
2017-10-19 14:28:19 -04:00
|
|
|
expect(response).to have_gitlab_http_status(200)
|
2017-02-21 16:37:00 -05:00
|
|
|
expect(response).to render_template(:show)
|
|
|
|
end
|
|
|
|
end
|
2018-11-19 10:03:58 -05:00
|
|
|
|
|
|
|
describe 'PUT cleanup' do
|
2018-12-13 12:52:38 -05:00
|
|
|
let(:object_map) { fixture_file_upload('spec/fixtures/bfg_object_map.txt') }
|
2018-12-07 06:16:48 -05:00
|
|
|
|
2018-12-13 12:52:38 -05:00
|
|
|
it 'enqueues a RepositoryCleanupWorker' do
|
|
|
|
allow(RepositoryCleanupWorker).to receive(:perform_async)
|
2018-11-19 10:03:58 -05:00
|
|
|
|
2018-12-17 17:52:17 -05:00
|
|
|
put :cleanup, params: { namespace_id: project.namespace, project_id: project, project: { object_map: object_map } }
|
2018-11-19 10:03:58 -05:00
|
|
|
|
2018-12-13 12:52:38 -05:00
|
|
|
expect(response).to redirect_to project_settings_repository_path(project)
|
|
|
|
expect(RepositoryCleanupWorker).to have_received(:perform_async).once
|
2018-11-19 10:03:58 -05:00
|
|
|
end
|
|
|
|
end
|
2017-02-21 16:37:00 -05:00
|
|
|
end
|