Skip to content
Merged
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
Unreleased ([changes](https://github.com/colszowka/simplecov/compare/v0.7.1...master))
-------------------

* [FEATURE] Adds support for Rails 4 command guessing.
See [#181](https://github.com/colszowka/simplecov/pull/181) (thanks to @semanticart)
* [REFACTORING] Rename adapters to "profiles" given that they are bundles of settings. The old adapter methods are
deprecated, but remain available for now.
See [#207](https://github.com/colszowka/simplecov/pull/207) (thanks to @mikerobe)
* [FEATURE] You can now load simplecov without the default settings by doing `require 'simplecov/no_defaults'
or setting `ENV['SIMPLECOV_NO_DEFAULTS']`. Check `simplecov/defaults` to see what preconfigurations are getting
dropped by using this.
* [BUGFIX] Average hits per line for groups of files is now computed correctly.
See [#192](http://github.com/colszowka/simplecov/pull/192) (thanks to @graysonwright)
* [FEATURE] Adds support for Rails 4 command guessing.
See [#209](https://github.com/colszowka/simplecov/pull/209) (thanks to @ileitch)
* [REFACTORING] Tweaks to the automatic test suite naming. In particular, `rspec/features` should now
be correctly attributed to RSpec, not Cucumber.
Expand Down
2 changes: 1 addition & 1 deletion lib/simplecov/file_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ def covered_percent
# Computes the strength (hits / line) based upon lines covered and lines missed
def covered_strength
return 0 if empty? or lines_of_code == 0
map {|f| f.covered_strength }.inject(&:+).to_f / size
map {|f| f.covered_strength * f.lines_of_code }.inject(&:+) / lines_of_code
end
end
15 changes: 7 additions & 8 deletions test/test_file_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ class TestFileList < Test::Unit::TestCase
setup do
original_result = {source_fixture('sample.rb') => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil],
source_fixture('app/models/user.rb') => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil],
source_fixture('app/controllers/sample_controller.rb') => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil]}
source_fixture('app/controllers/sample_controller.rb') => [nil, 2, 2, 0, nil, nil, 0, nil, nil, nil]}
@file_list = SimpleCov::Result.new(original_result).files
end

should("have 13 covered_lines") { assert_equal 13, @file_list.covered_lines }
should("have 2 missed_lines") { assert_equal 2, @file_list.missed_lines }
should("have 18 never_lines") { assert_equal 18, @file_list.never_lines }
should("have 15 lines_of_code") { assert_equal 15, @file_list.lines_of_code }
should("have 11 covered_lines") { assert_equal 11, @file_list.covered_lines }
should("have 3 missed_lines") { assert_equal 3, @file_list.missed_lines }
should("have 19 never_lines") { assert_equal 19, @file_list.never_lines }
should("have 14 lines_of_code") { assert_equal 14, @file_list.lines_of_code }
should("have 3 skipped_lines") { assert_equal 3, @file_list.skipped_lines }

should "have correct covered_percent" do
assert_equal 100.0*13/15, @file_list.covered_percent
end
should("have correct covered_percent") { assert_equal 100.0*11/14, @file_list.covered_percent }
should("have correct covered_strength") { assert_equal 13.to_f/14, @file_list.covered_strength }
end
end if SimpleCov.usable?