Sha256: ae3af99c7ae994168b989b13f8b49c16282af24f49b012bab2e7e7c7786af1ed
Contents?: true
Size: 548 Bytes
Versions: 40
Compression:
Stored size: 548 Bytes
Contents
class Stats include ActiveModel::Model attr_accessor :passed, :passed_with_warnings, :failed, :pending, :skipped def submitted passed + passed_with_warnings + failed end def done? failed + pending == 0 end def almost_done? failed + pending <= 1 end def started? submitted > 0 end def self.from_statuses(statuses) Stats.new(statuses.inject({passed: 0, passed_with_warnings: 0, failed: 0, pending: 0, skipped: 0}) do |accum, status| accum[status.group.to_sym] += 1 accum end) end end
Version data entries
40 entries across 40 versions & 1 rubygems