Class: GitlabQuality::TestTooling::CodeCoverage::TestReport
- Inherits:
-
Object
- Object
- GitlabQuality::TestTooling::CodeCoverage::TestReport
- Defined in:
- lib/gitlab_quality/test_tooling/code_coverage/test_report.rb
Instance Method Summary collapse
-
#examples ⇒ Array<Hash<String, String>>
Content of the “examples” section of the test report.
-
#initialize(test_report) ⇒ TestReport
constructor
A new instance of TestReport.
-
#tests_to_categories ⇒ Hash<String, Array<String>>
Test files mapped to all feature categories they belong to.
Constructor Details
#initialize(test_report) ⇒ TestReport
Returns a new instance of TestReport.
11 12 13 |
# File 'lib/gitlab_quality/test_tooling/code_coverage/test_report.rb', line 11 def initialize(test_report) @test_report = test_report end |
Instance Method Details
#examples ⇒ Array<Hash<String, String>>
Returns Content of the “examples” section of the test report.
17 18 19 |
# File 'lib/gitlab_quality/test_tooling/code_coverage/test_report.rb', line 17 def examples @examples ||= @test_report['examples'] end |
#tests_to_categories ⇒ Hash<String, Array<String>>
Returns Test files mapped to all feature categories they belong to.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/gitlab_quality/test_tooling/code_coverage/test_report.rb', line 30 def tests_to_categories @tests_to_categories ||= examples.to_a.filter_map do |example| next unless example.is_a?(Hash) file_path = example['file_path'] next unless file_path.is_a?(String) [file_path.gsub('./', ''), Array(example['feature_category']).compact] end.to_h end |