lib/korinthenkacker/test_report.rb in korinthenkacker-0.0.1 vs lib/korinthenkacker/test_report.rb in korinthenkacker-0.0.2

- old
+ new

@@ -1,46 +1,44 @@ require_relative 'test_case' module Korinthenkacker class TestReport - attr_reader :jobname, :build + attr_reader :jobname, :build, :json def initialize(jobname, build, json) @jobname = jobname @build = build @json = json end def duration - @json['duration'] + json['duration'] end def fail_count - @json['failCount'] + json['failCount'] end def pass_count - @json['passCount'] + json['passCount'] end def skip_count - @json['skipCount'] + json['skipCount'] end def success? fail_count == 0 && skip_count == 0 end - def failed_cases - all_cases.select { |test_case| !test_case.success? } + def failure? + !success? end - private - - def all_cases - @json['suites'] + def cases + json['suites'] .map { |suite| suite['cases'] } .flatten - .map { |my_case| TestCase.new(my_case) } + .map { |my_case| TestCase.new(my_case, build) } end end end