Class: Gitlab::Ci::Reports::TestReportsComparer

Inherits:
Object
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/ci/reports/test_reports_comparer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_reports, head_reports) ⇒ TestReportsComparer

Returns a new instance of TestReportsComparer.



11
12
13
14
# File 'lib/gitlab/ci/reports/test_reports_comparer.rb', line 11

def initialize(base_reports, head_reports)
  @base_reports = base_reports || TestReport.new
  @head_reports = head_reports
end

Instance Attribute Details

#base_reportsObject (readonly)

Returns the value of attribute base_reports.



9
10
11
# File 'lib/gitlab/ci/reports/test_reports_comparer.rb', line 9

def base_reports
  @base_reports
end

#head_reportsObject (readonly)

Returns the value of attribute head_reports.



9
10
11
# File 'lib/gitlab/ci/reports/test_reports_comparer.rb', line 9

def head_reports
  @head_reports
end

Instance Method Details

#suite_comparersObject



16
17
18
19
20
21
22
# File 'lib/gitlab/ci/reports/test_reports_comparer.rb', line 16

def suite_comparers
  strong_memoize(:suite_comparers) do
    head_reports.test_suites.map do |name, test_suite|
      TestSuiteComparer.new(name, base_reports.get_suite(name), test_suite)
    end
  end
end

#total_statusObject



24
25
26
27
28
29
30
# File 'lib/gitlab/ci/reports/test_reports_comparer.rb', line 24

def total_status
  if suite_comparers.any? { |suite| suite.total_status == TestCase::STATUS_FAILED }
    TestCase::STATUS_FAILED
  else
    TestCase::STATUS_SUCCESS
  end
end