debian-mirror-gitlab/app/serializers/test_case_entity.rb

26 lines
522 B
Ruby
Raw Normal View History

2018-11-20 20:47:30 +05:30
# frozen_string_literal: true
2018-11-18 11:00:15 +05:30
class TestCaseEntity < Grape::Entity
2020-04-22 19:07:51 +05:30
include API::Helpers::RelatedResourcesHelpers
2018-11-18 11:00:15 +05:30
expose :status
expose :name
2019-09-04 21:01:54 +05:30
expose :classname
2021-01-03 14:25:43 +05:30
expose :file
2018-11-18 11:00:15 +05:30
expose :execution_time
expose :system_output
expose :stack_trace
2021-01-29 00:20:46 +05:30
expose :recent_failures
2020-04-22 19:07:51 +05:30
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?
2021-06-08 01:23:25 +05:30
test_case.has_attachment?
2020-04-22 19:07:51 +05:30
end
2018-11-18 11:00:15 +05:30
end