Ever notice the cruft you get when running Rails tests from the command line? It’s horrible, especially if your project has more than a dozen test files:

/opt/local/bin/ruby -Ilib:test "/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb"
"test/unit/activity_test.rb" "test/unit/address_test.rb" "test/unit/application_helper_test.rb"
"test/unit/course_calculations_test.rb" "test/unit/course_test.rb" "test/unit/course_type_test.rb"
"test/unit/credit_hour_test.rb" "test/unit/email_test.rb" "test/unit/exam_test.rb" "test/unit/gender_test.rb"
"test/unit/grade_test.rb" "test/unit/level_test.rb" "test/unit/notifier_test.rb" "test/unit/numeric_test.rb"
"test/unit/obfuscator_test.rb" "test/unit/order_test.rb" "test/unit/school_test.rb" "test/unit/string_test.rb"
"test/unit/student_test.rb" "test/unit/transcript_test.rb" "test/unit/user_test.rb" 
Loaded suite /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader
Started
..................................................................
Finished in 2.509903 seconds.
 
66 tests, 140 assertions, 0 failures, 0 errors

M@ McCray recently posted a hack to the Terralien Campfire that gives you a nice, clean summary instead:

Loaded suite /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader
Started
..................................................................
Finished in 2.855885 seconds.
 
66 tests, 140 assertions, 0 failures, 0 errors

Want to start enjoying this super slim summary yourself? Just stick this code in your project’s Rakefile right before the require 'tasks/rails' bit:

Rake::TestTask.class_eval do
  alias_method :crufty_define, :define
  def define
    @verbose = false
    crufty_define
  end
end

Much better! We’re both surprised something like this isn’t already available in Core.