summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-06-14 16:23:41 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-06-14 16:23:41 +0800
commit931ab01adba637f6c36a976a19250e93096bc552 (patch)
tree8c2e0de40b88abc7d2b92bb0705351e28c1ec425 /spec/controllers
parentf99cee8e9cfcc8eaf340e487503682bb5699591a (diff)
parentb29bf62602b6e962ceb31dd7535743a7d8c4864c (diff)
downloadgitlab-ce-931ab01adba637f6c36a976a19250e93096bc552.tar.gz
Merge remote-tracking branch 'upstream/master' into 33149-rename-more-builds
* upstream/master: (34 commits) Revert "Merge branch 'karma-headless-chrome' into 'master'" Make small pipeline schedules UI enhancements. Remove js classes from vue component that are not needed in vue component Update tests and application Adds "Pipeline" to job's sidebar Change border color of job's scroll controllers to $border-color Add database helpers 'add_timestamps_with_timezone' and 'timestamps_with_timezone' Added Tectonic to the page. Always check read_issue permissions when loading issue Handle legacy jobs without name Do not expose internal artifacts hash in build entity Use wait_for_requests instead of sleep 0.3 Limit wiki container width Fix migrations testing support RSpec hooks order Rename BuildEntity to JobEntity Fix support for external_url for commit statuses Allow to access pipelines even if they are disabled, but only present jobs and commit statuses without giving ability to access them add CHANGELOG.md entry for !12036 remove phantomjs-specific test hacks update karma job to use chrome build image created by gitlab-build-images!41 ...
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/pipelines_controller_spec.rb37
1 files changed, 30 insertions, 7 deletions
diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb
index 954f89e3854..734532668d3 100644
--- a/spec/controllers/projects/pipelines_controller_spec.rb
+++ b/spec/controllers/projects/pipelines_controller_spec.rb
@@ -5,9 +5,12 @@ describe Projects::PipelinesController do
let(:user) { create(:user) }
let(:project) { create(:empty_project, :public) }
+ let(:feature) { ProjectFeature::DISABLED }
before do
project.add_developer(user)
+ project.project_feature.update(
+ builds_access_level: feature)
sign_in(user)
end
@@ -153,16 +156,26 @@ describe Projects::PipelinesController do
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
+ context 'when builds are enabled' do
+ let(:feature) { ProjectFeature::ENABLED }
+
+ 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
+
+ context 'when builds are disabled' do
+ it 'fails to retry pipeline' do
+ expect(response).to have_http_status(:not_found)
+ end
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,
@@ -170,9 +183,19 @@ describe Projects::PipelinesController do
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
+ context 'when builds are enabled' do
+ let(:feature) { ProjectFeature::ENABLED }
+
+ 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
+
+ context 'when builds are disabled' do
+ it 'fails to retry pipeline' do
+ expect(response).to have_http_status(:not_found)
+ end
end
end
end