Permalink
Browse files

Fix typo and add sanity test for code statistics rake task.

Signed-off-by: José Valim <jose.valim@gmail.com>
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
miloops authored and spastorino committed Sep 24, 2010
1 parent 49d54b4 commit 8a68862020bf12d5df8564daa0ccd8de5bd476a1
Showing with 7 additions and 2 deletions.
  1. +1 −1 railties/lib/rails/code_statistics.rb
  2. +6 −1 railties/test/application/rake_test.rb
@@ -23,7 +23,7 @@ def to_s
private
def calculate_statistics
- @pairs.inject({}) { |stats, pair| stats[pair.first] = calculate_directory_statistics(pair.last); stats }
+ Hash[@pairs.map{|pair| [pair.first, calculate_directory_statistics(pair.last)]}]
end
def calculate_directory_statistics(directory, pattern = /.*\.rb$/)
@@ -33,5 +33,10 @@ def test_environment_is_required_in_rake_tasks
assert_match "SuperMiddleware", Dir.chdir(app_path){ `rake middleware` }
end
+
+ def test_code_statistics_sanity
+ assert_match "Code LOC: 5 Test LOC: 0 Code to Test Ratio: 1:0.0",
+ Dir.chdir(app_path){ `rake stats` }
+ end
end
-end
+end

0 comments on commit 8a68862

Please sign in to comment.