debian-mirror-gitlab/app/serializers/test_case_entity.rb
2020-04-22 19:07:51 +05:30

23 lines
554 B
Ruby

# 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