From 6e0eb9235a75fb8e0be5b34d4ecdddcb3fa37cb8 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Sun, 9 Dec 2012 00:04:36 -0500 Subject: Make code statistics rake task handle new test locations properly As of 2a68f68aead9fd65ecac8062ca8efc15f5bab418: - Unit tests are now in test/models, instead of test/units - Functional tests are now in test/controllers, instead of test/functional - Helper tests are now in test/helpers, instead of test/units/helpers - Mailer tests are now in test/mailers, instead of test/functional Update the rake task for code statistics (`rake stats`) so that it recognizes files in the above locations as tests, and accurately calculates statistics such as "Test LOC" and "Code to Test Ratio." Safely handle Rails apps that still have tests in the old locations. --- railties/lib/rails/code_statistics.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/railties/lib/rails/code_statistics.rb b/railties/lib/rails/code_statistics.rb index 1aed2796c1..039360fcf6 100644 --- a/railties/lib/rails/code_statistics.rb +++ b/railties/lib/rails/code_statistics.rb @@ -1,6 +1,12 @@ class CodeStatistics #:nodoc: - TEST_TYPES = %w(Units Functionals Unit\ tests Functional\ tests Integration\ tests) + TEST_TYPES = ['Controller tests', + 'Helper tests', + 'Model tests', + 'Mailer tests', + 'Integration tests', + 'Functional tests (old)', + 'Unit tests (old)'] def initialize(*pairs) @pairs = pairs -- cgit v1.2.3