simplecov-patched 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +31 -0
- data/.rspec +3 -0
- data/.rubocop.yml +88 -0
- data/.travis.yml +29 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +435 -0
- data/CONTRIBUTING.md +48 -0
- data/Gemfile +38 -0
- data/MIT-LICENSE +20 -0
- data/README.md +646 -0
- data/Rakefile +41 -0
- data/cucumber.yml +13 -0
- data/doc/alternate-formatters.md +36 -0
- data/doc/commercial-services.md +20 -0
- data/doc/editor-integration.md +13 -0
- data/features/config_autoload.feature +46 -0
- data/features/config_command_name.feature +45 -0
- data/features/config_coverage_dir.feature +33 -0
- data/features/config_deactivate_merging.feature +42 -0
- data/features/config_formatters.feature +77 -0
- data/features/config_merge_timeout.feature +39 -0
- data/features/config_nocov_token.feature +79 -0
- data/features/config_profiles.feature +44 -0
- data/features/config_project_name.feature +27 -0
- data/features/config_styles.feature +121 -0
- data/features/config_tracked_files.feature +29 -0
- data/features/cucumber_basic.feature +29 -0
- data/features/maximum_coverage_drop.feature +89 -0
- data/features/merging_test_unit_and_rspec.feature +44 -0
- data/features/minimum_coverage.feature +59 -0
- data/features/refuse_coverage_drop.feature +95 -0
- data/features/rspec_basic.feature +32 -0
- data/features/rspec_fails_on_initialization.feature +14 -0
- data/features/rspec_groups_and_filters_basic.feature +29 -0
- data/features/rspec_groups_and_filters_complex.feature +37 -0
- data/features/rspec_groups_using_filter_class.feature +41 -0
- data/features/rspec_without_simplecov.feature +20 -0
- data/features/skipping_code_blocks_manually.feature +70 -0
- data/features/step_definitions/html_steps.rb +44 -0
- data/features/step_definitions/simplecov_steps.rb +68 -0
- data/features/step_definitions/transformers.rb +13 -0
- data/features/step_definitions/web_steps.rb +64 -0
- data/features/support/env.rb +50 -0
- data/features/test_unit_basic.feature +34 -0
- data/features/test_unit_groups_and_filters_basic.feature +29 -0
- data/features/test_unit_groups_and_filters_complex.feature +35 -0
- data/features/test_unit_groups_using_filter_class.feature +40 -0
- data/features/test_unit_without_simplecov.feature +20 -0
- data/features/unicode_compatiblity.feature +67 -0
- data/lib/simplecov.rb +189 -0
- data/lib/simplecov/command_guesser.rb +59 -0
- data/lib/simplecov/configuration.rb +307 -0
- data/lib/simplecov/defaults.rb +121 -0
- data/lib/simplecov/exit_codes.rb +8 -0
- data/lib/simplecov/file_list.rb +59 -0
- data/lib/simplecov/filter.rb +54 -0
- data/lib/simplecov/formatter.rb +8 -0
- data/lib/simplecov/formatter/multi_formatter.rb +32 -0
- data/lib/simplecov/formatter/simple_formatter.rb +23 -0
- data/lib/simplecov/jruby_fix.rb +42 -0
- data/lib/simplecov/last_run.rb +24 -0
- data/lib/simplecov/load_global_config.rb +6 -0
- data/lib/simplecov/no_defaults.rb +2 -0
- data/lib/simplecov/profiles.rb +31 -0
- data/lib/simplecov/railtie.rb +7 -0
- data/lib/simplecov/railties/tasks.rake +11 -0
- data/lib/simplecov/raw_coverage.rb +39 -0
- data/lib/simplecov/result.rb +86 -0
- data/lib/simplecov/result_merger.rb +95 -0
- data/lib/simplecov/source_file.rb +196 -0
- data/lib/simplecov/version.rb +25 -0
- data/spec/1_8_fallbacks_spec.rb +31 -0
- data/spec/command_guesser_spec.rb +48 -0
- data/spec/config_loader_spec.rb +14 -0
- data/spec/configuration_spec.rb +35 -0
- data/spec/deleted_source_spec.rb +12 -0
- data/spec/faked_project/Gemfile +6 -0
- data/spec/faked_project/Rakefile +8 -0
- data/spec/faked_project/cucumber.yml +13 -0
- data/spec/faked_project/features/step_definitions/my_steps.rb +22 -0
- data/spec/faked_project/features/support/env.rb +12 -0
- data/spec/faked_project/features/test_stuff.feature +6 -0
- data/spec/faked_project/lib/faked_project.rb +11 -0
- data/spec/faked_project/lib/faked_project/framework_specific.rb +18 -0
- data/spec/faked_project/lib/faked_project/meta_magic.rb +24 -0
- data/spec/faked_project/lib/faked_project/some_class.rb +28 -0
- data/spec/faked_project/lib/faked_project/untested_class.rb +11 -0
- data/spec/faked_project/spec/faked_spec.rb +11 -0
- data/spec/faked_project/spec/forking_spec.rb +8 -0
- data/spec/faked_project/spec/meta_magic_spec.rb +15 -0
- data/spec/faked_project/spec/some_class_spec.rb +13 -0
- data/spec/faked_project/spec/spec_helper.rb +11 -0
- data/spec/faked_project/test/faked_test.rb +11 -0
- data/spec/faked_project/test/meta_magic_test.rb +13 -0
- data/spec/faked_project/test/some_class_test.rb +15 -0
- data/spec/faked_project/test/test_helper.rb +12 -0
- data/spec/file_list_spec.rb +50 -0
- data/spec/filters_spec.rb +98 -0
- data/spec/fixtures/app/controllers/sample_controller.rb +10 -0
- data/spec/fixtures/app/models/user.rb +10 -0
- data/spec/fixtures/deleted_source_sample.rb +15 -0
- data/spec/fixtures/frameworks/rspec_bad.rb +9 -0
- data/spec/fixtures/frameworks/rspec_good.rb +9 -0
- data/spec/fixtures/frameworks/testunit_bad.rb +9 -0
- data/spec/fixtures/frameworks/testunit_good.rb +9 -0
- data/spec/fixtures/iso-8859.rb +3 -0
- data/spec/fixtures/never.rb +2 -0
- data/spec/fixtures/resultset1.rb +4 -0
- data/spec/fixtures/resultset2.rb +4 -0
- data/spec/fixtures/sample.rb +16 -0
- data/spec/fixtures/skipped.rb +4 -0
- data/spec/fixtures/skipped_and_executed.rb +8 -0
- data/spec/fixtures/utf-8.rb +3 -0
- data/spec/helper.rb +26 -0
- data/spec/last_run_spec.rb +48 -0
- data/spec/multi_formatter_spec.rb +20 -0
- data/spec/raw_coverage_spec.rb +92 -0
- data/spec/result_merger_spec.rb +96 -0
- data/spec/result_spec.rb +209 -0
- data/spec/return_codes_spec.rb +34 -0
- data/spec/simplecov_spec.rb +110 -0
- data/spec/source_file_line_spec.rb +155 -0
- data/spec/source_file_spec.rb +141 -0
- data/spec/support/fail_rspec_on_ruby_warning.rb +75 -0
- metadata +320 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@test_unit @config @profiles
|
|
2
|
+
Feature:
|
|
3
|
+
|
|
4
|
+
In order to re-use SimpleCov settings across projects,
|
|
5
|
+
profiles can be defined that hold configuration settings
|
|
6
|
+
that can be loaded at once.
|
|
7
|
+
|
|
8
|
+
Background:
|
|
9
|
+
Given SimpleCov for Test/Unit is configured with:
|
|
10
|
+
"""
|
|
11
|
+
require 'simplecov'
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
Scenario: Defining and using a custom profile
|
|
15
|
+
Given a file named ".simplecov" with:
|
|
16
|
+
"""
|
|
17
|
+
SimpleCov.profiles.define 'custom_command' do
|
|
18
|
+
command_name "Profile Command"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
SimpleCov.start do
|
|
22
|
+
load_profile 'test_frameworks'
|
|
23
|
+
load_profile 'custom_command'
|
|
24
|
+
end
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
28
|
+
Then I should see "4 files in total."
|
|
29
|
+
And I should see "using Profile Command" within "#footer"
|
|
30
|
+
|
|
31
|
+
Scenario: Using existing profile in custom profile and supplying profile to start command
|
|
32
|
+
Given a file named ".simplecov" with:
|
|
33
|
+
"""
|
|
34
|
+
SimpleCov.profiles.define 'my_profile' do
|
|
35
|
+
load_profile 'test_frameworks'
|
|
36
|
+
command_name "My Profile"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
SimpleCov.start 'my_profile'
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
43
|
+
Then I should see "4 files in total."
|
|
44
|
+
And I should see "using My Profile" within "#footer"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@test_unit @config
|
|
2
|
+
Feature:
|
|
3
|
+
|
|
4
|
+
SimpleCov guesses the project name from the project root dir's name.
|
|
5
|
+
If this is not sufficient for you, you can specify a custom name using
|
|
6
|
+
SimpleCov.project_name('xyz')
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Scenario: Guessed name
|
|
10
|
+
Given SimpleCov for Test/Unit is configured with:
|
|
11
|
+
"""
|
|
12
|
+
require 'simplecov'
|
|
13
|
+
SimpleCov.start
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
17
|
+
Then I should see "Code coverage for Project" within "title"
|
|
18
|
+
|
|
19
|
+
Scenario: Custom name
|
|
20
|
+
Given SimpleCov for Test/Unit is configured with:
|
|
21
|
+
"""
|
|
22
|
+
require 'simplecov'
|
|
23
|
+
SimpleCov.start { project_name "Superfancy 2.0" }
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
27
|
+
Then I should see "Code coverage for Superfancy 2.0" within "title"
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
@test_unit @config
|
|
2
|
+
Feature:
|
|
3
|
+
|
|
4
|
+
There's several ways to configure SimpleCov. All of those
|
|
5
|
+
config schemes below are equivalent and can be chosen by personal
|
|
6
|
+
preference or project requirements.
|
|
7
|
+
|
|
8
|
+
Background:
|
|
9
|
+
Given SimpleCov for Test/Unit is configured with:
|
|
10
|
+
"""
|
|
11
|
+
require 'simplecov'
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
Scenario: Inside start block
|
|
15
|
+
Given a file named ".simplecov" with:
|
|
16
|
+
"""
|
|
17
|
+
SimpleCov.start do
|
|
18
|
+
add_filter 'test'
|
|
19
|
+
command_name 'Config Test Runner'
|
|
20
|
+
end
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
24
|
+
Then I should see "4 files in total."
|
|
25
|
+
And I should see "using Config Test Runner" within "#footer"
|
|
26
|
+
|
|
27
|
+
Scenario: Inside start block, using instance var from outside
|
|
28
|
+
Given a file named ".simplecov" with:
|
|
29
|
+
"""
|
|
30
|
+
@filter = 'test'
|
|
31
|
+
SimpleCov.start do
|
|
32
|
+
add_filter @filter
|
|
33
|
+
command_name 'Config Test Runner'
|
|
34
|
+
end
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
38
|
+
Then I should see "4 files in total."
|
|
39
|
+
And I should see "using Config Test Runner" within "#footer"
|
|
40
|
+
|
|
41
|
+
Scenario: Inside start block, using local var from outside
|
|
42
|
+
Given a file named ".simplecov" with:
|
|
43
|
+
"""
|
|
44
|
+
filter = 'test'
|
|
45
|
+
SimpleCov.start do
|
|
46
|
+
add_filter filter
|
|
47
|
+
command_name 'Config Test Runner'
|
|
48
|
+
end
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
52
|
+
Then I should see "4 files in total."
|
|
53
|
+
And I should see "using Config Test Runner" within "#footer"
|
|
54
|
+
|
|
55
|
+
Scenario: Explicitly before start block
|
|
56
|
+
Given a file named ".simplecov" with:
|
|
57
|
+
"""
|
|
58
|
+
SimpleCov.add_filter 'test'
|
|
59
|
+
SimpleCov.command_name 'Config Test Runner'
|
|
60
|
+
SimpleCov.start
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
64
|
+
Then I should see "4 files in total."
|
|
65
|
+
And I should see "using Config Test Runner" within "#footer"
|
|
66
|
+
|
|
67
|
+
Scenario: Explicitly after start block
|
|
68
|
+
Given a file named ".simplecov" with:
|
|
69
|
+
"""
|
|
70
|
+
SimpleCov.start
|
|
71
|
+
SimpleCov.add_filter 'test'
|
|
72
|
+
SimpleCov.command_name 'Config Test Runner'
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
76
|
+
Then I should see "4 files in total."
|
|
77
|
+
And I should see "using Config Test Runner" within "#footer"
|
|
78
|
+
|
|
79
|
+
Scenario: Using configure block after start
|
|
80
|
+
Given a file named ".simplecov" with:
|
|
81
|
+
"""
|
|
82
|
+
SimpleCov.start
|
|
83
|
+
SimpleCov.configure do
|
|
84
|
+
add_filter 'test'
|
|
85
|
+
command_name 'Config Test Runner'
|
|
86
|
+
end
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
90
|
+
Then I should see "4 files in total."
|
|
91
|
+
And I should see "using Config Test Runner" within "#footer"
|
|
92
|
+
|
|
93
|
+
Scenario: Using configure block before start
|
|
94
|
+
Given a file named ".simplecov" with:
|
|
95
|
+
"""
|
|
96
|
+
SimpleCov.configure do
|
|
97
|
+
add_filter 'test'
|
|
98
|
+
command_name 'Config Test Runner'
|
|
99
|
+
end
|
|
100
|
+
SimpleCov.start
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
104
|
+
Then I should see "4 files in total."
|
|
105
|
+
And I should see "using Config Test Runner" within "#footer"
|
|
106
|
+
|
|
107
|
+
Scenario: Mixing configure and start block config
|
|
108
|
+
Given a file named ".simplecov" with:
|
|
109
|
+
"""
|
|
110
|
+
SimpleCov.configure do
|
|
111
|
+
command_name 'Config Test Runner'
|
|
112
|
+
end
|
|
113
|
+
SimpleCov.start do
|
|
114
|
+
add_filter 'test'
|
|
115
|
+
end
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
119
|
+
Then I should see "4 files in total."
|
|
120
|
+
And I should see "using Config Test Runner" within "#footer"
|
|
121
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@test_unit
|
|
2
|
+
Feature:
|
|
3
|
+
|
|
4
|
+
Using the setting `tracked_files` should add files that were not
|
|
5
|
+
required to the report.
|
|
6
|
+
|
|
7
|
+
Scenario:
|
|
8
|
+
Given SimpleCov for Test/Unit is configured with:
|
|
9
|
+
"""
|
|
10
|
+
require 'simplecov'
|
|
11
|
+
SimpleCov.start do
|
|
12
|
+
track_files "lib/**/*.rb"
|
|
13
|
+
end
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
17
|
+
Then I should see the groups:
|
|
18
|
+
| name | coverage | files |
|
|
19
|
+
| All Files | 76.81% | 7 |
|
|
20
|
+
|
|
21
|
+
And I should see the source files:
|
|
22
|
+
| name | coverage |
|
|
23
|
+
| lib/faked_project.rb | 100.0 % |
|
|
24
|
+
| lib/faked_project/untested_class.rb | 0.0 % |
|
|
25
|
+
| lib/faked_project/some_class.rb | 80.0 % |
|
|
26
|
+
| lib/faked_project/framework_specific.rb | 75.0 % |
|
|
27
|
+
| lib/faked_project/meta_magic.rb | 100.0 % |
|
|
28
|
+
| test/meta_magic_test.rb | 100.0 % |
|
|
29
|
+
| test/some_class_test.rb | 100.0 % |
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@cucumber
|
|
2
|
+
Feature:
|
|
3
|
+
|
|
4
|
+
Simply adding the basic simplecov lines to a project should get
|
|
5
|
+
the user a coverage report after running `cucumber features`
|
|
6
|
+
|
|
7
|
+
Scenario:
|
|
8
|
+
Given SimpleCov for Cucumber is configured with:
|
|
9
|
+
"""
|
|
10
|
+
require 'simplecov'
|
|
11
|
+
SimpleCov.start
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
When I open the coverage report generated with `bundle exec cucumber features`
|
|
15
|
+
Then I should see the groups:
|
|
16
|
+
| name | coverage | files |
|
|
17
|
+
| All Files | 91.23% | 6 |
|
|
18
|
+
|
|
19
|
+
And I should see the source files:
|
|
20
|
+
| name | coverage |
|
|
21
|
+
| lib/faked_project.rb | 100.0 % |
|
|
22
|
+
| lib/faked_project/some_class.rb | 80.0 % |
|
|
23
|
+
| lib/faked_project/framework_specific.rb | 75.0 % |
|
|
24
|
+
| lib/faked_project/meta_magic.rb | 100.0 % |
|
|
25
|
+
| features/step_definitions/my_steps.rb | 100.0 % |
|
|
26
|
+
| features/support/simplecov_config.rb | 100.0 % |
|
|
27
|
+
|
|
28
|
+
And the report should be based upon:
|
|
29
|
+
| Cucumber Features |
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
@test_unit @config
|
|
2
|
+
Feature:
|
|
3
|
+
|
|
4
|
+
Exit code should be non-zero if the overall coverage decreases by more than
|
|
5
|
+
the maximum_coverage_drop threshold.
|
|
6
|
+
|
|
7
|
+
Scenario: maximum_coverage_drop configured cam cause spec failure
|
|
8
|
+
Given SimpleCov for Test/Unit is configured with:
|
|
9
|
+
"""
|
|
10
|
+
require 'simplecov'
|
|
11
|
+
SimpleCov.start do
|
|
12
|
+
add_filter 'test.rb'
|
|
13
|
+
maximum_coverage_drop 3.14
|
|
14
|
+
end
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
When I run `bundle exec rake test`
|
|
18
|
+
Then the exit status should be 0
|
|
19
|
+
And a file named "coverage/.last_run.json" should exist
|
|
20
|
+
|
|
21
|
+
Given a file named "lib/faked_project/missed.rb" with:
|
|
22
|
+
"""
|
|
23
|
+
class UncoveredSourceCode
|
|
24
|
+
def foo
|
|
25
|
+
never_reached
|
|
26
|
+
rescue => err
|
|
27
|
+
but no one cares about invalid ruby here
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
When I run `bundle exec rake test`
|
|
33
|
+
Then the exit status should not be 0
|
|
34
|
+
And the output should contain "Coverage has dropped by 3.32% since the last time (maximum allowed: 3.14%)."
|
|
35
|
+
And a file named "coverage/.last_run.json" should exist
|
|
36
|
+
And the file "coverage/.last_run.json" should contain:
|
|
37
|
+
"""
|
|
38
|
+
{
|
|
39
|
+
"result": {
|
|
40
|
+
"covered_percent": 88.1
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
Scenario: maximum_coverage_drop not configured updates resultset
|
|
46
|
+
Given SimpleCov for Test/Unit is configured with:
|
|
47
|
+
"""
|
|
48
|
+
require 'simplecov'
|
|
49
|
+
SimpleCov.start do
|
|
50
|
+
add_filter 'test.rb'
|
|
51
|
+
end
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
When I run `bundle exec rake test`
|
|
55
|
+
Then the exit status should be 0
|
|
56
|
+
And a file named "coverage/.last_run.json" should exist
|
|
57
|
+
And the file "coverage/.last_run.json" should contain:
|
|
58
|
+
"""
|
|
59
|
+
{
|
|
60
|
+
"result": {
|
|
61
|
+
"covered_percent": 88.1
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
Given a file named "lib/faked_project/missed.rb" with:
|
|
67
|
+
"""
|
|
68
|
+
class UncoveredSourceCode
|
|
69
|
+
def foo
|
|
70
|
+
never_reached
|
|
71
|
+
rescue => err
|
|
72
|
+
but no one cares about invalid ruby here
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
When I run `bundle exec rake test`
|
|
78
|
+
Then the exit status should be 0
|
|
79
|
+
And a file named "coverage/.last_run.json" should exist
|
|
80
|
+
And the file "coverage/.last_run.json" should contain:
|
|
81
|
+
"""
|
|
82
|
+
{
|
|
83
|
+
"result": {
|
|
84
|
+
"covered_percent": 84.78
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@test_unit @rspec @merging
|
|
2
|
+
Feature:
|
|
3
|
+
|
|
4
|
+
Test suites like RSpec and Test/Unit should be merged automatically
|
|
5
|
+
when both have been run recently. The coverage report will feature
|
|
6
|
+
the joined results of all test suites that are using SimpleCov.
|
|
7
|
+
|
|
8
|
+
Scenario:
|
|
9
|
+
Given SimpleCov for Test/Unit is configured with:
|
|
10
|
+
"""
|
|
11
|
+
require 'simplecov'
|
|
12
|
+
SimpleCov.start do
|
|
13
|
+
add_filter 'test.rb'
|
|
14
|
+
add_filter 'spec.rb'
|
|
15
|
+
end
|
|
16
|
+
"""
|
|
17
|
+
And SimpleCov for RSpec is configured with:
|
|
18
|
+
"""
|
|
19
|
+
require 'simplecov'
|
|
20
|
+
SimpleCov.start do
|
|
21
|
+
add_filter 'test.rb'
|
|
22
|
+
add_filter 'spec.rb'
|
|
23
|
+
end
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
When I open the coverage report generated with `bundle exec rake test`
|
|
27
|
+
Then the report should be based upon:
|
|
28
|
+
| Unit Tests |
|
|
29
|
+
|
|
30
|
+
When I open the coverage report generated with `bundle exec rspec spec`
|
|
31
|
+
Then the report should be based upon:
|
|
32
|
+
| RSpec |
|
|
33
|
+
| Unit Tests |
|
|
34
|
+
|
|
35
|
+
And I should see the groups:
|
|
36
|
+
| name | coverage | files |
|
|
37
|
+
| All Files | 90.48% | 4 |
|
|
38
|
+
|
|
39
|
+
And I should see the source files:
|
|
40
|
+
| name | coverage |
|
|
41
|
+
| lib/faked_project.rb | 100.0 % |
|
|
42
|
+
| lib/faked_project/some_class.rb | 80.0 % |
|
|
43
|
+
| lib/faked_project/framework_specific.rb | 87.5 % |
|
|
44
|
+
| lib/faked_project/meta_magic.rb | 100.0 % |
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@test_unit @config
|
|
2
|
+
Feature:
|
|
3
|
+
|
|
4
|
+
Exit code should be non-zero if the overall coverage is below the
|
|
5
|
+
minimum_coverage threshold.
|
|
6
|
+
|
|
7
|
+
Scenario:
|
|
8
|
+
Given SimpleCov for Test/Unit is configured with:
|
|
9
|
+
"""
|
|
10
|
+
require 'simplecov'
|
|
11
|
+
SimpleCov.start do
|
|
12
|
+
add_filter 'test.rb'
|
|
13
|
+
minimum_coverage 90
|
|
14
|
+
end
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
When I run `bundle exec rake test`
|
|
18
|
+
Then the exit status should not be 0
|
|
19
|
+
And the output should contain "Coverage (88.10%) is below the expected minimum coverage (90.00%)."
|
|
20
|
+
|
|
21
|
+
Scenario:
|
|
22
|
+
Given SimpleCov for Test/Unit is configured with:
|
|
23
|
+
"""
|
|
24
|
+
require 'simplecov'
|
|
25
|
+
SimpleCov.start do
|
|
26
|
+
add_filter 'test.rb'
|
|
27
|
+
minimum_coverage 88.11
|
|
28
|
+
end
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
When I run `bundle exec rake test`
|
|
32
|
+
Then the exit status should not be 0
|
|
33
|
+
And the output should contain "Coverage (88.10%) is below the expected minimum coverage (88.11%)."
|
|
34
|
+
|
|
35
|
+
Scenario:
|
|
36
|
+
Given SimpleCov for Test/Unit is configured with:
|
|
37
|
+
"""
|
|
38
|
+
require 'simplecov'
|
|
39
|
+
SimpleCov.start do
|
|
40
|
+
add_filter 'test.rb'
|
|
41
|
+
minimum_coverage 88.10
|
|
42
|
+
end
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
When I run `bundle exec rake test`
|
|
46
|
+
Then the exit status should be 0
|
|
47
|
+
|
|
48
|
+
Scenario:
|
|
49
|
+
Given SimpleCov for Test/Unit is configured with:
|
|
50
|
+
"""
|
|
51
|
+
require 'simplecov'
|
|
52
|
+
SimpleCov.start do
|
|
53
|
+
add_filter 'test.rb'
|
|
54
|
+
end
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
When I run `bundle exec rake test`
|
|
58
|
+
Then the exit status should be 0
|
|
59
|
+
|