2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Projects::Settings::RepositoryController do
|
|
|
|
let(:project) { create(:project_empty_repo, :public) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2017-08-17 22:00:37 +05:30
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET show' do
|
|
|
|
it 'renders show with 200 status code' do
|
2019-02-15 15:39:39 +05:30
|
|
|
get :show, params: { namespace_id: project.namespace, project_id: project }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
expect(response).to have_gitlab_http_status(:ok)
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(response).to render_template(:show)
|
|
|
|
end
|
|
|
|
end
|
2019-02-15 15:39:39 +05:30
|
|
|
|
|
|
|
describe 'PUT cleanup' do
|
|
|
|
let(:object_map) { fixture_file_upload('spec/fixtures/bfg_object_map.txt') }
|
|
|
|
|
|
|
|
it 'enqueues a RepositoryCleanupWorker' do
|
|
|
|
allow(RepositoryCleanupWorker).to receive(:perform_async)
|
|
|
|
|
|
|
|
put :cleanup, params: { namespace_id: project.namespace, project_id: project, project: { object_map: object_map } }
|
|
|
|
|
|
|
|
expect(response).to redirect_to project_settings_repository_path(project)
|
|
|
|
expect(RepositoryCleanupWorker).to have_received(:perform_async).once
|
|
|
|
end
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
|
|
|
|
describe 'POST create_deploy_token' do
|
|
|
|
let(:deploy_token_params) do
|
|
|
|
{
|
|
|
|
name: 'deployer_token',
|
|
|
|
expires_at: 1.month.from_now.to_date.to_s,
|
|
|
|
username: 'deployer',
|
|
|
|
read_repository: '1'
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
subject(:create_deploy_token) { post :create_deploy_token, params: { namespace_id: project.namespace, project_id: project, deploy_token: deploy_token_params } }
|
|
|
|
|
|
|
|
it 'creates deploy token' do
|
|
|
|
expect { create_deploy_token }.to change { DeployToken.active.count }.by(1)
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
expect(response).to have_gitlab_http_status(:ok)
|
2019-09-30 21:07:59 +05:30
|
|
|
expect(response).to render_template(:show)
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|