Skip to content

Commit 6e0eb92

Browse files
Make code statistics rake task handle new test locations properly
As of 2a68f68: - 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.
1 parent bb8923d commit 6e0eb92

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

railties/lib/rails/code_statistics.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
class CodeStatistics #:nodoc:
22

3-
TEST_TYPES = %w(Units Functionals Unit\ tests Functional\ tests Integration\ tests)
3+
TEST_TYPES = ['Controller tests',
4+
'Helper tests',
5+
'Model tests',
6+
'Mailer tests',
7+
'Integration tests',
8+
'Functional tests (old)',
9+
'Unit tests (old)']
410

511
def initialize(*pairs)
612
@pairs = pairs

0 commit comments

Comments
 (0)