diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-26 09:08:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-26 09:08:40 +0300 |
commit | 116d4e56e83a1f408afe710ce070e699ba206475 (patch) | |
tree | cc62d3820d9bfa199061edfdef3a2f4bda140507 /app/serializers | |
parent | dddde902acfa6acfb11583c61faa67cc7c8d11b6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/test_case_entity.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/serializers/test_case_entity.rb b/app/serializers/test_case_entity.rb index 5c915c1302c..d2e08590ef0 100644 --- a/app/serializers/test_case_entity.rb +++ b/app/serializers/test_case_entity.rb @@ -1,10 +1,23 @@ # frozen_string_literal: true class TestCaseEntity < Grape::Entity + include API::Helpers::RelatedResourcesHelpers + expose :status expose :name expose :classname expose :execution_time expose :system_output expose :stack_trace + expose :attachment_url, if: -> (*) { can_read_screenshots? } do |test_case| + expose_url(test_case.attachment_url) + end + + private + + alias_method :test_case, :object + + def can_read_screenshots? + Feature.enabled?(:junit_pipeline_screenshots_view, options[:project]) && test_case.has_attachment? + end end |