Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Array#sum not in stdlib. Also, Automatically register the runner

  • Loading branch information...
commit 13f84b39d603397a024f5277a439a412dbf4af34 1 parent 332dbe8
@quirkey authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/minitest/display.rb
View
8 lib/minitest/display.rb
@@ -1,3 +1,5 @@
+require 'minitest/unit'
+
class Hash
unless method_defined?(:deep_merge!)
@@ -134,7 +136,7 @@ def _run_suite(suite, type)
filter = Regexp.new $1 if filter =~ /\/(.*)\//
# PATCH
- wrap_at = display.options[:wrap_at] - suite_header.length
+ wrap_at = display.options[:wrap_at] - suite_header.length if suite_header
wrap_count = wrap_at
full_start_time = Time.now
@@ -209,7 +211,7 @@ def display_slow_tests
end
def display_slow_suites
- times = @test_times.map { |suite, tests| [suite, tests.map(&:last).sum] }.sort { |a, b| b[1] <=> a[1] }
+ times = @test_times.map { |suite, tests| [suite, tests.map(&:last).inject {|sum, n| sum + n }] }.sort { |a, b| b[1] <=> a[1] }
puts "Slowest suites:"
times[0..display.options[:output_slow_suites].to_i].each do |suite, time|
puts "%.2f s\t#{suite}" % time
@@ -221,3 +223,5 @@ def display
::MiniTest::Display
end
end
+
+MiniTest::Unit.runner = MiniTest::Display::Runner.new
Please sign in to comment.
Something went wrong with that request. Please try again.