summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-04 21:01:15 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-05 09:32:13 +0200
commit4f3dc19aafdd71aedb6b086da5707315a9a51ace (patch)
treea8f0f6a3f4de1fee3fa3322c1d60433730d6725a
parentc68bf4327b3e4811e001adeca84ad0f88c421455 (diff)
downloadgitlab-ce-30237-pipelines-actions-make-2-requests.tar.gz
Add specs for new pipeline action for JSON format30237-pipelines-actions-make-2-requests
-rw-r--r--spec/controllers/projects/pipelines_controller_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb
index b9bacc5a64a..1b47d163c0b 100644
--- a/spec/controllers/projects/pipelines_controller_spec.rb
+++ b/spec/controllers/projects/pipelines_controller_spec.rb
@@ -5,6 +5,8 @@ describe Projects::PipelinesController do
let(:project) { create(:empty_project, :public) }
before do
+ project.add_developer(user)
+
sign_in(user)
end
@@ -87,4 +89,38 @@ describe Projects::PipelinesController do
expect(json_response['favicon']).to eq "/assets/ci_favicons/#{status.favicon}.ico"
end
end
+
+ describe 'POST retry.json' do
+ let!(:pipeline) { create(:ci_pipeline, :failed, project: project) }
+ let!(:build) { create(:ci_build, :failed, pipeline: pipeline) }
+
+ before do
+ post :retry, namespace_id: project.namespace,
+ project_id: project,
+ id: pipeline.id,
+ format: :json
+ end
+
+ it 'retries a pipeline without returning any content' do
+ expect(response).to have_http_status(:no_content)
+ expect(build.reload).to be_retried
+ end
+ end
+
+ describe 'POST cancel.json' do
+ let!(:pipeline) { create(:ci_pipeline, project: project) }
+ let!(:build) { create(:ci_build, :running, pipeline: pipeline) }
+
+ before do
+ post :cancel, namespace_id: project.namespace,
+ project_id: project,
+ id: pipeline.id,
+ format: :json
+ end
+
+ it 'cancels a pipeline without returning any content' do
+ expect(response).to have_http_status(:no_content)
+ expect(pipeline.reload).to be_canceled
+ end
+ end
end