Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/projects/pipelines_controller_spec.rb')
-rw-r--r--spec/controllers/projects/pipelines_controller_spec.rb35
1 files changed, 29 insertions, 6 deletions
diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb
index 4a51e2ed5a0..8fae82d54a2 100644
--- a/spec/controllers/projects/pipelines_controller_spec.rb
+++ b/spec/controllers/projects/pipelines_controller_spec.rb
@@ -292,12 +292,8 @@ RSpec.describe Projects::PipelinesController do
subject { project.namespace }
- context 'code_quality_walkthrough experiment' do
- it_behaves_like 'tracks assignment and records the subject', :code_quality_walkthrough, :namespace
- end
-
- context 'ci_runner_templates experiment' do
- it_behaves_like 'tracks assignment and records the subject', :ci_runner_templates, :namespace
+ context 'runners_availability_section experiment' do
+ it_behaves_like 'tracks assignment and records the subject', :runners_availability_section, :namespace
end
end
@@ -936,6 +932,33 @@ RSpec.describe Projects::PipelinesController do
expect(response).to have_gitlab_http_status(:not_found)
end
end
+
+ context 'when access denied' do
+ it 'returns an error' do
+ sign_in(create(:user))
+
+ post_retry
+
+ expect(response).to have_gitlab_http_status(:not_found)
+ end
+ end
+
+ context 'when service returns an error' do
+ before do
+ service_response = ServiceResponse.error(message: 'some error', http_status: 404)
+ allow_next_instance_of(::Ci::RetryPipelineService) do |service|
+ allow(service).to receive(:check_access).and_return(service_response)
+ end
+ end
+
+ it 'does not retry' do
+ post_retry
+
+ expect(response).to have_gitlab_http_status(:not_found)
+ expect(response.body).to include('some error')
+ expect(::Ci::RetryPipelineWorker).not_to have_received(:perform_async).with(pipeline.id, user.id)
+ end
+ end
end
describe 'POST cancel.json' do