simplecov-rspec 0.1.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f72895c7f0c30898b8b0359e0b4f6f8cafa838b7f9deb59fb220cef5e8a92c4
4
- data.tar.gz: a383b340c09720a2a9440d714a5d289271c1174577f6cd9a8afecb645f7ba78e
3
+ metadata.gz: 6cd20182766238dffc8bc1cbce5e10e8535c4f7b161061613b6b6a74e03d18ce
4
+ data.tar.gz: 2451f8c6723de90f596a0d475562245acb1aad4b143bdd22669d31c107eda8ff
5
5
  SHA512:
6
- metadata.gz: 58626ae17aff8c6645255092e1ec565d8b85f26824915b532471367ede6f900732c168fffbd659c946604ffc7e7b8ea53aa931aadffeede2a96b3350d820d0fe
7
- data.tar.gz: c5dfe1463c2edd3bd72ad4cc215ad2371d53d51254e4ebd4fa33ee25aeacb6f6ee9b3ff880214ae42ff12482330c934676aa487e937c09d7ec85e577866db64a
6
+ metadata.gz: fd4d19e6e3376ad8b391d5e59cf80c6e135e726b861d6063e3e3ee3920efddc08133f6549d79d0391d745cea73405ebe12faac31136a50b053569b59e2c58288
7
+ data.tar.gz: 1063210e9667c592a51e2e48d86c7df0e6233bda9e5e38016d987c6c61f261e297d814ae9ca6f6f1529056474883b5221f14a6e6ed66cf0b17779f2c0160694e
data/.rubocop.yml CHANGED
@@ -35,3 +35,6 @@ Style/AsciiComments:
35
35
 
36
36
  Style/StderrPuts:
37
37
  Enabled: false
38
+
39
+ Naming/FileName:
40
+ Exclude: ['lib/simplecov-rspec.rb', 'spec/simplecov-rspec_spec.rb']
data/CHANGELOG.md CHANGED
@@ -4,6 +4,27 @@ 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.1 (2024-09-10)
8
+
9
+ [Full Changelog](https://github.com/main-branch/simplecov-rspec/compare/v0.2.0..v0.2.1)
10
+
11
+ Changes since v0.2.0:
12
+
13
+ * d714b58 Simplify how the experimental ruby builds are triggered
14
+ * de79d66 Use a reusable workflow for the Semver PR label check
15
+ * d29ecac Add Semver PR Label workflow
16
+ * 0fed875 Update the version of code climate test coverage reporter
17
+
18
+ ## v0.2.0 (2024-09-08)
19
+
20
+ [Full Changelog](https://github.com/main-branch/simplecov-rspec/compare/v0.1.0..v0.2.0)
21
+
22
+ Changes since v0.1.0:
23
+
24
+ * 2b544ee Allow the CI build to be manually triggered
25
+ * 50e1b4a Rename lib/simplecov/rspec to lib/simplecov-rspec (and related files)
26
+ * 0884d23 Move CI build using Ruby head to an different workflow
27
+
7
28
  ## v0.1.0 (2024-09-07)
8
29
 
9
30
  [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/rspec'` to your `spec_helper.rb`.
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/rspec'
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/rspec'
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.stats_options = ['--list-undoc']
63
+ t.options = %w[--no-private]
64
+ t.stats_options = %w[--list-undoc]
64
65
  end
65
66
 
66
67
  CLEAN << '.yardoc'
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Simplecov
4
+ class Rspec
5
+ # This gem's version
6
+ VERSION = '0.2.1'
7
+ end
8
+ end
@@ -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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplecov-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Couball
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-08 00:00:00.000000000 Z
11
+ date: 2024-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler-audit
@@ -201,16 +201,16 @@ files:
201
201
  - LICENSE.txt
202
202
  - README.md
203
203
  - Rakefile
204
- - lib/simplecov/rspec.rb
205
- - lib/simplecov/rspec/version.rb
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.1.0/file/CHANGELOG.md
213
- documentation_uri: https://rubydoc.info/gems/simplecov-rspec/0.1.0
212
+ changelog_uri: https://rubydoc.info/gems/simplecov-rspec/0.2.1/file/CHANGELOG.md
213
+ documentation_uri: https://rubydoc.info/gems/simplecov-rspec/0.2.1
214
214
  rubygems_mfa_required: 'true'
215
215
  post_install_message:
216
216
  rdoc_options: []
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # SimpleCov module
4
- module Simplecov
5
- # SimpleCov::RSpec module
6
- module Rspec
7
- # This gem's version
8
- VERSION = '0.1.0'
9
- end
10
- end