-
Notifications
You must be signed in to change notification settings - Fork 576
Expand file tree
/
Copy pathminimum_coverage_by_file.feature
More file actions
72 lines (62 loc) · 2.48 KB
/
minimum_coverage_by_file.feature
File metadata and controls
72 lines (62 loc) · 2.48 KB
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
@test_unit @config
Feature:
Exit code should be non-zero if the coverage of any one file is below the configured value.
Background:
Given I'm working on the project "faked_project"
Scenario: slightly under minimum coverage by file
Given SimpleCov for Test/Unit is configured with:
"""
require 'simplecov'
SimpleCov.start do
add_filter 'test.rb'
minimum_coverage_by_file 75.01
end
"""
When I run `bundle exec rake test`
Then the exit status should not be 0
And the output should contain "Line coverage by file (75.00%) is below the expected minimum coverage (75.01%) in framework_specific.rb."
And the output should contain "SimpleCov failed with exit 2"
Scenario: Just passing it
Given SimpleCov for Test/Unit is configured with:
"""
require 'simplecov'
SimpleCov.start do
add_filter 'test.rb'
minimum_coverage_by_file 75
end
"""
When I run `bundle exec rake test`
Then the exit status should be 0
@branch_coverage
Scenario: Works together with branch coverage and the new criterion announcing both failures
Given SimpleCov for Test/Unit is configured with:
"""
require 'simplecov'
SimpleCov.start do
add_filter 'test.rb'
enable_coverage :branch
minimum_coverage_by_file line: 90, branch: 70
end
"""
When I run `bundle exec rake test`
Then the exit status should not be 0
And the output should contain "Line coverage by file (80.00%) is below the expected minimum coverage (90.00%) in some_class.rb."
And the output should contain "Branch coverage by file (50.00%) is below the expected minimum coverage (70.00%) in some_class.rb."
And the output should contain "SimpleCov failed with exit 2"
@branch_coverage
Scenario: Can set branch as primary coverage and it will fail if branch is below minimum coverage
Given SimpleCov for Test/Unit is configured with:
"""
require 'simplecov'
SimpleCov.start do
add_filter 'test.rb'
enable_coverage :branch
primary_coverage :branch
minimum_coverage_by_file 70
end
"""
When I run `bundle exec rake test`
Then the exit status should not be 0
And the output should contain "Branch coverage by file (50.00%) is below the expected minimum coverage (70.00%) in some_class.rb."
And the output should not contain "Line coverage"
And the output should contain "SimpleCov failed with exit 2"