simplecov-rspec 0.1.0 → 0.2.0
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 +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +10 -0
- data/README.md +3 -3
- data/Rakefile +2 -1
- data/lib/simplecov-rspec/version.rb +8 -0
- data/lib/{simplecov/rspec.rb → simplecov-rspec.rb} +29 -2
- metadata +5 -5
- data/lib/simplecov/rspec/version.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f85ad1153e6f9763be15065fb878d655e678c2b25822fc0cfd0c34702d8555f
|
4
|
+
data.tar.gz: efb0fcb94e7391d3d2179fa77d31a1964bcdce7de6f84c503e9deb082c9d1b12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0507b2f6bcc191dcde75aa43c5a78b808fbb0437b1894751028e44f31c96b5f07499a837aa768e681d8b0ba149363ddb3c410e2a677c053383de24dfb32efd39
|
7
|
+
data.tar.gz: 65a297b875d450c10533d0186ccc5612ab9687a9b8fc2074528713d377ff3d37f3713128a0f8ba08976674c3566c1bf5b91bd4316687f8f9c7de79eafee9c5c7
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,16 @@ Changes for each release are listed in this file.
|
|
4
4
|
|
5
5
|
This project adheres to [Semantic Versioning](https://semver.org/) for its releases.
|
6
6
|
|
7
|
+
## v0.2.0 (2024-09-08)
|
8
|
+
|
9
|
+
[Full Changelog](https://github.com/main-branch/simplecov-rspec/compare/v0.1.0..v0.2.0)
|
10
|
+
|
11
|
+
Changes since v0.1.0:
|
12
|
+
|
13
|
+
* 2b544ee Allow the CI build to be manually triggered
|
14
|
+
* 50e1b4a Rename lib/simplecov/rspec to lib/simplecov-rspec (and related files)
|
15
|
+
* 0884d23 Move CI build using Ruby head to an different workflow
|
16
|
+
|
7
17
|
## v0.1.0 (2024-09-07)
|
8
18
|
|
9
19
|
[Full Changelog](https://github.com/main-branch/simplecov-rspec/compare/9fe828c..v0.1.0)
|
data/README.md
CHANGED
@@ -56,7 +56,7 @@ gem install simplecov-rspec
|
|
56
56
|
|
57
57
|
To use `simplecov-rspec`, follow these steps:
|
58
58
|
|
59
|
-
1. Add `require 'simplecov
|
59
|
+
1. Add `require 'simplecov-rspec'` to your `spec_helper.rb`.
|
60
60
|
2. Replace `SimpleCov.start` with `SimpleCov::RSpec.start` in your `spec_helper.rb`,
|
61
61
|
ensuring this line appears before requiring your project files.
|
62
62
|
|
@@ -64,7 +64,7 @@ Here is an example `spec_helper.rb`. Your spec helper may include
|
|
64
64
|
other code in addition to these:
|
65
65
|
|
66
66
|
```ruby
|
67
|
-
require 'simplecov
|
67
|
+
require 'simplecov-rspec'
|
68
68
|
|
69
69
|
SimpleCov::RSpec.start
|
70
70
|
|
@@ -80,7 +80,7 @@ That is it!
|
|
80
80
|
To initialize simplecov-rspec with defaults, add the following to your `spec_helper.rb`:
|
81
81
|
|
82
82
|
```ruby
|
83
|
-
require 'simplecov
|
83
|
+
require 'simplecov-rspec'
|
84
84
|
|
85
85
|
SimpleCov::RSpec.start
|
86
86
|
```
|
data/Rakefile
CHANGED
@@ -60,7 +60,8 @@ unless RUBY_PLATFORM == 'java'
|
|
60
60
|
|
61
61
|
YARD::Rake::YardocTask.new('yard:build') do |t|
|
62
62
|
t.files = %w[lib/**/*.rb examples/**/*]
|
63
|
-
t.
|
63
|
+
t.options = %w[--no-private]
|
64
|
+
t.stats_options = %w[--list-undoc]
|
64
65
|
end
|
65
66
|
|
66
67
|
CLEAN << '.yardoc'
|
@@ -32,16 +32,19 @@ module SimpleCov
|
|
32
32
|
# Command line environment variables (default: ENV)
|
33
33
|
# @return [Hash]
|
34
34
|
# @api private
|
35
|
+
# @private
|
35
36
|
#
|
36
37
|
# @!attribute [r] simplecov_module
|
37
38
|
# The SimpleCov module (default: ::SimpleCov)
|
38
39
|
# @return [Module]
|
39
40
|
# @api private
|
41
|
+
# @private
|
40
42
|
#
|
41
43
|
# @!attribute [r] start_config_block
|
42
44
|
# A configuration block to pass to `SimpleCov.start`
|
43
45
|
# @return [Proc]
|
44
46
|
# @api private
|
47
|
+
# @private
|
45
48
|
#
|
46
49
|
# @api public
|
47
50
|
#
|
@@ -132,21 +135,33 @@ module SimpleCov
|
|
132
135
|
# rubocop:enable Layout/LineLength
|
133
136
|
|
134
137
|
# Environment variable to override coverage_threshold
|
138
|
+
# @api private
|
139
|
+
# @private
|
135
140
|
COVERAGE_THRESHOLD = 'COVERAGE_THRESHOLD'
|
136
141
|
|
137
142
|
# Environment variable to override fail_on_low_coverage
|
143
|
+
# @api private
|
144
|
+
# @private
|
138
145
|
FAIL_ON_LOW_COVERAGE = 'FAIL_ON_LOW_COVERAGE'
|
139
146
|
|
140
147
|
# Environment variable to override list_uncovered_lines
|
148
|
+
# @api private
|
149
|
+
# @private
|
141
150
|
LIST_UNCOVERED_LINES = 'LIST_UNCOVERED_LINES'
|
142
151
|
|
143
152
|
# Default value for coverage_threshold
|
153
|
+
# @api private
|
154
|
+
# @private
|
144
155
|
DEFAULT_TEST_COVERAGE_THRESHOLD = 100
|
145
156
|
|
146
157
|
# Default value for fail_on_low_coverage
|
158
|
+
# @api private
|
159
|
+
# @private
|
147
160
|
DEFAULT_FAIL_ON_LOW_COVERAGEERAGE = true
|
148
161
|
|
149
162
|
# Default value for list_uncovered_lines
|
163
|
+
# @api private
|
164
|
+
# @private
|
150
165
|
DEFAULT_LIST_UNCOVERED_LINES = false
|
151
166
|
|
152
167
|
attr_reader :env, :simplecov_module, :start_config_block
|
@@ -159,6 +174,7 @@ module SimpleCov
|
|
159
174
|
# @return [Integer]
|
160
175
|
#
|
161
176
|
# @api private
|
177
|
+
# @private
|
162
178
|
#
|
163
179
|
def coverage_threshold
|
164
180
|
return env.fetch(COVERAGE_THRESHOLD).to_i if env.key?(COVERAGE_THRESHOLD)
|
@@ -176,6 +192,7 @@ module SimpleCov
|
|
176
192
|
# @return [Boolean]
|
177
193
|
#
|
178
194
|
# @api private
|
195
|
+
# @private
|
179
196
|
#
|
180
197
|
def fail_on_low_coverage?
|
181
198
|
return false if rspec_dry_run?
|
@@ -195,6 +212,7 @@ module SimpleCov
|
|
195
212
|
# @return [Boolean]
|
196
213
|
#
|
197
214
|
# @api private
|
215
|
+
# @private
|
198
216
|
#
|
199
217
|
def list_uncovered_lines?
|
200
218
|
return env_true?(LIST_UNCOVERED_LINES) if env.key?(LIST_UNCOVERED_LINES)
|
@@ -209,6 +227,7 @@ module SimpleCov
|
|
209
227
|
# @return [Boolean]
|
210
228
|
#
|
211
229
|
# @api private
|
230
|
+
# @private
|
212
231
|
#
|
213
232
|
def rspec_dry_run? = @rspec_dry_run
|
214
233
|
|
@@ -219,6 +238,7 @@ module SimpleCov
|
|
219
238
|
# Create a new SimpleCov::RSpec instance
|
220
239
|
# @see SimpleCov::RSpec.start
|
221
240
|
# @api private
|
241
|
+
# @private
|
222
242
|
def initialize(
|
223
243
|
coverage_threshold: nil,
|
224
244
|
fail_on_low_coverage: nil,
|
@@ -242,6 +262,7 @@ module SimpleCov
|
|
242
262
|
# Set the at_exit hook and then configure and start SimpleCov
|
243
263
|
# @return [Void]
|
244
264
|
# @api private
|
265
|
+
# @private
|
245
266
|
def start
|
246
267
|
simplecov_module.at_exit(&at_exit_hook)
|
247
268
|
simplecov_module.start(&start_config_block)
|
@@ -250,6 +271,7 @@ module SimpleCov
|
|
250
271
|
# Called by SimpleCov.at_exit
|
251
272
|
# @return [Proc]
|
252
273
|
# @api private
|
274
|
+
# @private
|
253
275
|
def at_exit_hook
|
254
276
|
lambda do
|
255
277
|
simplecov_module.result.format!
|
@@ -261,6 +283,7 @@ module SimpleCov
|
|
261
283
|
# Output the at_exit report
|
262
284
|
# @return [Void]
|
263
285
|
# @api private
|
286
|
+
# @private
|
264
287
|
def output_at_exit_report
|
265
288
|
low_coverage_report if show_low_coverage_report?
|
266
289
|
lines_not_covered_report if show_lines_not_covered_report?
|
@@ -270,16 +293,19 @@ module SimpleCov
|
|
270
293
|
# Whether to show the low coverage report
|
271
294
|
# @return [Boolean]
|
272
295
|
# @api private
|
296
|
+
# @private
|
273
297
|
def show_low_coverage_report? = coverage_below_threshold?
|
274
298
|
|
275
299
|
# Whether the test coverage is below the threshold
|
276
300
|
# @return [Boolean]
|
277
301
|
# @api private
|
302
|
+
# @private
|
278
303
|
def coverage_below_threshold? = simplecov_module.result.covered_percent < coverage_threshold
|
279
304
|
|
280
305
|
# Output the low coverage part of the at_exit report
|
281
306
|
# @return [Void]
|
282
307
|
# @api private
|
308
|
+
# @private
|
283
309
|
def low_coverage_report
|
284
310
|
$stderr.puts
|
285
311
|
$stderr.print 'FAIL: ' if fail_on_low_coverage?
|
@@ -294,11 +320,13 @@ module SimpleCov
|
|
294
320
|
# Whether to show lines not covered report
|
295
321
|
# @return [Boolean]
|
296
322
|
# @api private
|
323
|
+
# @private
|
297
324
|
def show_lines_not_covered_report? = list_uncovered_lines? && uncovered_lines_found?
|
298
325
|
|
299
326
|
# Output the lines not covered part of the at_exit report
|
300
327
|
# @return [Void]
|
301
328
|
# @api private
|
329
|
+
# @private
|
302
330
|
def lines_not_covered_report
|
303
331
|
$stderr.puts
|
304
332
|
$stderr.puts "The following lines were not covered by tests:\n"
|
@@ -317,6 +345,7 @@ module SimpleCov
|
|
317
345
|
# @param name [String] the name of the environment variable
|
318
346
|
# @return [Boolean]
|
319
347
|
# @api private
|
348
|
+
# @private
|
320
349
|
#
|
321
350
|
def env_true?(name)
|
322
351
|
value = env.fetch(name, '').downcase
|
@@ -324,5 +353,3 @@ module SimpleCov
|
|
324
353
|
end
|
325
354
|
end
|
326
355
|
end
|
327
|
-
|
328
|
-
require_relative 'rspec/version'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecov-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Couball
|
@@ -201,16 +201,16 @@ files:
|
|
201
201
|
- LICENSE.txt
|
202
202
|
- README.md
|
203
203
|
- Rakefile
|
204
|
-
- lib/simplecov
|
205
|
-
- lib/simplecov
|
204
|
+
- lib/simplecov-rspec.rb
|
205
|
+
- lib/simplecov-rspec/version.rb
|
206
206
|
homepage: https://github.com/main-branch/simplecov-rspec
|
207
207
|
licenses:
|
208
208
|
- MIT
|
209
209
|
metadata:
|
210
210
|
allowed_push_host: https://rubygems.org
|
211
211
|
homepage_uri: https://github.com/main-branch/simplecov-rspec
|
212
|
-
changelog_uri: https://rubydoc.info/gems/simplecov-rspec/0.
|
213
|
-
documentation_uri: https://rubydoc.info/gems/simplecov-rspec/0.
|
212
|
+
changelog_uri: https://rubydoc.info/gems/simplecov-rspec/0.2.0/file/CHANGELOG.md
|
213
|
+
documentation_uri: https://rubydoc.info/gems/simplecov-rspec/0.2.0
|
214
214
|
rubygems_mfa_required: 'true'
|
215
215
|
post_install_message:
|
216
216
|
rdoc_options: []
|