Class: Minitest::Reporters::RedisReporter::Base

Inherits:
BaseReporter
  • Object
show all
Defined in:
lib/minitest/reporters/redis_reporter.rb

Direct Known Subclasses

Summary, Worker

Instance Method Summary collapse

Constructor Details

#initialize(redis:, build_id:, **options) ⇒ Base

Returns a new instance of Base.



90
91
92
93
94
# File 'lib/minitest/reporters/redis_reporter.rb', line 90

def initialize(redis:, build_id:, **options)
  @redis = redis
  @key = "build:#{build_id}"
  super(options)
end

Instance Method Details

#completed? ⇒ Boolean

Returns:

  • (Boolean)


104
105
106
# File 'lib/minitest/reporters/redis_reporter.rb', line 104

def completed?
  total > 0 && total == processed
end

#error_reports ⇒ Object



108
109
110
# File 'lib/minitest/reporters/redis_reporter.rb', line 108

def error_reports
  redis.hgetall(key('error-reports')).sort_by(&:first).map { |k, v| Error.load(v) }
end

#processed ⇒ Object



100
101
102
# File 'lib/minitest/reporters/redis_reporter.rb', line 100

def processed
  redis.scard(key('processed')).to_i
end

#total ⇒ Object



96
97
98
# File 'lib/minitest/reporters/redis_reporter.rb', line 96

def total
  redis.get(key('total')).to_i
end