1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
@test_unit @nocov
Feature:
Code wrapped in # :nocov: will be ignored by coverage reports.
The name of the token can be configured with SimpleCov.nocov_token or SimpleCov.skip_token
Background:
Given I'm working on the project "faked_project"
Scenario: Custom nocov token using nocov_token
Given SimpleCov for Test/Unit is configured with:
"""
require 'simplecov'
SimpleCov.start 'test_frameworks' do
nocov_token 'skippit'
end
"""
Given a file named "lib/faked_project/nocov.rb" with:
"""
class SourceCodeWithNocov
# :skippit:
def some_weird_code
never_reached
rescue => err
but no one cares about invalid ruby here
end
# :skippit:
end
"""
When I open the coverage report generated with `bundle exec rake test`
Then I should see the source files:
| name | coverage |
| lib/faked_project.rb | 100.00 % |
| lib/faked_project/some_class.rb | 80.00 % |
| lib/faked_project/framework_specific.rb | 75.00 % |
| lib/faked_project/meta_magic.rb | 100.00 % |
| lib/faked_project/nocov.rb | 100.00 % |
And there should be 7 skipped lines in the source files
And the report should be based upon:
| Unit Tests |
Scenario: Custom nocov token using skip_token
Given SimpleCov for Test/Unit is configured with:
"""
require 'simplecov'
SimpleCov.start 'test_frameworks' do
skip_token 'skippit'
end
"""
Given a file named "lib/faked_project/nocov.rb" with:
"""
class SourceCodeWithNocov
# :skippit:
def some_weird_code
never_reached
rescue => err
but no one cares about invalid ruby here
end
# :skippit:
end
"""
When I open the coverage report generated with `bundle exec rake test`
Then I should see the source files:
| name | coverage |
| lib/faked_project.rb | 100.00 % |
| lib/faked_project/some_class.rb | 80.00 % |
| lib/faked_project/framework_specific.rb | 75.00 % |
| lib/faked_project/meta_magic.rb | 100.00 % |
| lib/faked_project/nocov.rb | 100.00 % |
And there should be 7 skipped lines in the source files
And the report should be based upon:
| Unit Tests |
|