-
Notifications
You must be signed in to change notification settings - Fork 553
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a refuse_coverage_drop configuration option
[Fixes #11]
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@test_unit @config | ||
Feature: | ||
|
||
Exit code should be non-zero if the overall coverage decreases. | ||
|
||
Scenario: | ||
Given SimpleCov for Test/Unit is configured with: | ||
""" | ||
require 'simplecov' | ||
SimpleCov.start do | ||
add_filter 'test.rb' | ||
refuse_coverage_drop | ||
end | ||
""" | ||
|
||
When I run `bundle exec rake test` | ||
Then the exit status should be 0 | ||
And a file named "coverage/.last_run.json" should exist | ||
|
||
Given a file named "lib/faked_project/missed.rb" with: | ||
""" | ||
class UncoveredSourceCode | ||
def foo | ||
never_reached | ||
rescue => err | ||
but no one cares about invalid ruby here | ||
end | ||
end | ||
""" | ||
|
||
When I run `bundle exec rake test` | ||
Then the exit status should not be 0 | ||
And the output should contain "Coverage has dropped by 3.31% since the last time (maximum allowed: 0.00%)." | ||
And a file named "coverage/.last_run.json" should exist | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters