gitlab-org--gitlab-foss/spec/controllers/projects/settings/repository_controller_spec.rb

36 lines
1 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'spec_helper'
describe Projects::Settings::RepositoryController do
let(:project) { create(:project_empty_repo, :public) }
let(:user) { create(:user) }
before do
project.add_maintainer(user)
sign_in(user)
end
describe 'GET show' do
it 'renders show with 200 status code' do
get :show, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template(:show)
end
end
2018-11-19 10:03:58 -05:00
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)
2018-11-19 10:03:58 -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
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
end