Add integration spec
This commit is contained in:
parent
49af84c2b0
commit
7fe14c42a9
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue