class Minitest::HogReporter
Constants
- Record
Attributes
max_memory[R]
piggy_tests[R]
Public Class Methods
new(io = STDOUT, options = {})
click to toggle source
Calls superclass method
# File lib/minitest/hog.rb, line 43 def initialize(io = STDOUT, options = {}) super @max_memory = options.fetch(:max_memory, 64) @piggy_tests = [] end
Public Instance Methods
record(result)
click to toggle source
# File lib/minitest/hog.rb, line 50 def record result if result.memory_used > max_memory piggy_tests << Record.new(result.location, result.memory_used) end end
report()
click to toggle source
# File lib/minitest/hog.rb, line 56 def report return if piggy_tests.empty? piggy_tests.sort_by!{|r| -r.memory_used} io.puts io.puts "#{piggy_tests.length} hogs." piggy_tests.each_with_index do |record, i| io.puts "%3d) %s: %i kb" % [i+1, record.location, record.memory_used] end end