Class: SpecTracker::Reporter::ReportMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/spec_tracker/reporter/report_mapper.rb

Instance Method Summary collapse

Instance Method Details

#map(scenarios:, test_results:, topic:) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/spec_tracker/reporter/report_mapper.rb', line 4

def map(scenarios:, test_results:, topic:)
  report_data = scenarios.map do |scenario|
    test_result = test_results.detect {|test_result| test_result.scenario_id == scenario.id}
    if test_result
      test_status = test_result.status
    else
      test_status = TestStatus.new
      test_status.missing!
    end
    ReportDatum.new(scenario_id: scenario.id, scenario_name: scenario.name, status: test_status)
  end
  Report.new(data: report_data, topic: topic)
end