summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-10-02 18:47:41 +0900
committerAlessio Caiazza <acaiazza@gitlab.com>2018-10-02 17:08:14 +0200
commit7fe14c42a913c683bd6f7c4f8791fff63db3c499 (patch)
tree3b8433a5dc98dd9691466d6b4acd85e44044053d
parent49af84c2b0df199f1d8cda16a126ce6701e07743 (diff)
downloadgitlab-ce-7fe14c42a913c683bd6f7c4f8791fff63db3c499.tar.gz
Add integration spec
-rw-r--r--spec/controllers/projects/jobs_controller_spec.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/controllers/projects/jobs_controller_spec.rb b/spec/controllers/projects/jobs_controller_spec.rb
index fd11cb31a2a..f1eefdbaaaf 100644
--- a/spec/controllers/projects/jobs_controller_spec.rb
+++ b/spec/controllers/projects/jobs_controller_spec.rb
@@ -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)