summaryrefslogtreecommitdiff
path: root/app/controllers/projects/pipelines/tests_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects/pipelines/tests_controller.rb')
-rw-r--r--app/controllers/projects/pipelines/tests_controller.rb17
1 files changed, 10 insertions, 7 deletions
diff --git a/app/controllers/projects/pipelines/tests_controller.rb b/app/controllers/projects/pipelines/tests_controller.rb
index e5b2dd14f69..20bdb4d3af1 100644
--- a/app/controllers/projects/pipelines/tests_controller.rb
+++ b/app/controllers/projects/pipelines/tests_controller.rb
@@ -7,6 +7,7 @@ module Projects
before_action :authorize_read_build!
before_action :builds, only: [:show]
+ before_action :validate_test_reports!, only: [:show]
feature_category :code_testing
@@ -23,19 +24,21 @@ module Projects
def show
respond_to do |format|
format.json do
- if pipeline.has_expired_test_reports?
- render json: { errors: 'Test report artifacts have expired' }, status: :not_found
- else
- render json: TestSuiteSerializer
- .new(project: project, current_user: @current_user)
- .represent(test_suite, details: true)
- end
+ render json: TestSuiteSerializer
+ .new(project: project, current_user: @current_user)
+ .represent(test_suite, details: true)
end
end
end
private
+ def validate_test_reports!
+ unless pipeline.has_test_reports?
+ render json: { errors: 'Test report artifacts have expired' }, status: :not_found
+ end
+ end
+
def builds
@builds ||= pipeline.latest_builds.id_in(build_ids).presence || render_404
end