Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/code_metrics/stats_directories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def initialize
@root = path_prefix
@app_directories = default_app_directories
@test_directories = default_test_directories
@test_directories.each do |pair|
CodeMetrics::Statistics::TEST_TYPES << pair.first
end
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be in default_test_directories

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that -- I guess it depends on whether or not you expect default_test_directories to be public and/or called more than once, so I put it in initialize so that it was only evaluated once (also hopefully ensuring we don't get dupes in TEST_TYPES).

end

def directories
Expand Down
9 changes: 9 additions & 0 deletions test/dummy/test/controllers/application_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class ApplicationControllerTest < ActionController::TestCase
test "truth" do
assert true
end

test "negativity" do
assert_not false
end
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably don't need this test :)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait, you're calculating LOC on this, n/m

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that "Test LOC" will always be zero for rake_test.rb if this file is not present.

The "negativity" test is so that the ratio is not 1:1.

end
2 changes: 1 addition & 1 deletion test/rake_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module CodeMetrics
class RakeTest < ActiveSupport::TestCase

def test_code_metrics_sanity
assert_match "Code LOC: 5 Test LOC: 0 Code to Test Ratio: 1:0.0",
assert_match "Code LOC: 5 Test LOC: 8 Code to Test Ratio: 1:1.6",
Dir.chdir(app_path){ `rake code_metrics:stats` }
end

Expand Down