Commit 7fe14c42 authored by Shinya Maeda's avatar Shinya Maeda Committed by Alessio Caiazza

Add integration spec

parent 49af84c2
......@@ -632,6 +632,46 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
end
describe 'POST unschedule' do
before do
project.add_developer(user)
create(:protected_branch, :developers_can_merge,
name: 'master', project: project)
sign_in(user)
post_unschedule
end
context 'when job is scheduled' do
let(:job) { create(:ci_build, :scheduled, pipeline: pipeline) }
it 'redirects to the unscheduled job page' do
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(namespace_project_job_path(id: job.id))
end
it 'transits to manual' do
expect(job.reload).to be_manual
end
end
context 'when job is not scheduled' do
let(:job) { create(:ci_build, pipeline: pipeline) }
it 'renders unprocessable_entity' do
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
def post_unschedule
post :unschedule, namespace_id: project.namespace,
project_id: project,
id: job.id
end
end
describe 'POST cancel_all' do
before do
project.add_developer(user)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment