rubocop-minitest 0.35.0 → 0.35.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b38207770e46d47923f0558a40d051717d6909d540875bdb72cd63594e7b172b
4
- data.tar.gz: b0b493b7e7ae9bf171379bf8a9c5ac6b02d44e2edbe29246928a71d9e5c6e81f
3
+ metadata.gz: '05352938661fc7fcd76a982a2a9154061c503eac54de9f2de2e0f358d8e166a4'
4
+ data.tar.gz: 38db4cb7b31a2829857ccd97f57d4991a482ce7fd7406032bbcf680051581075
5
5
  SHA512:
6
- metadata.gz: df6202e016d32b4ffc3fe066ca3785ecf8bc30dd2e0b76f858be48fe9399439b779762eed9f49d812ffeb47c4389926611f58ae06027832b331e89b7390407db
7
- data.tar.gz: 6b2d444f5b2bd62fb31fe5e6808628eb03b5f3843f69b3e91d677abf57351d12140ba52ba06f6dab49bbffaf12ac5255df4553efa258a069d1cf5bb39a16f719
6
+ metadata.gz: a0935959142328adc6acedeccabe3abda0cf0284de0a4069a3612101d2cccd67d5374c343f2f3de176c05d9a7db6cc2f85a63eae59c826a888bea6d0505515ae
7
+ data.tar.gz: 033b27f081581b35cc46c55fcea3ac3a2c09c069fe35d0bb41635bbaea4626cbb89b5ff4fa892ec32a9ae8df8f9f9106edb0ac9e4dd7ca3125e218410bb4dc42
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # RuboCop Minitest
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/rubocop-minitest.svg)](https://badge.fury.io/rb/rubocop-minitest)
4
- [![CircleCI](https://circleci.com/gh/rubocop/rubocop-minitest.svg?style=svg)](https://circleci.com/gh/rubocop/rubocop-minitest)
4
+ [![CI](https://github.com/rubocop/rubocop-minitest/actions/workflows/test.yml/badge.svg)](https://github.com/rubocop/rubocop-minitest/actions/workflows/test.yml)
5
5
 
6
6
  A [RuboCop](https://github.com/rubocop/rubocop) extension focused on enforcing [Minitest](https://github.com/minitest/minitest) best practices and coding conventions.
7
7
  The library is based on the guidelines outlined in the community [Minitest Style Guide](https://minitest.rubystyle.guide).
@@ -28,11 +28,12 @@ module RuboCop
28
28
  # end
29
29
  #
30
30
  class MultipleAssertions < Base
31
- include ConfigurableMax
32
31
  include MinitestExplorationHelpers
33
32
 
34
33
  MSG = 'Test case has too many assertions [%<total>d/%<max>d].'
35
34
 
35
+ exclude_limit 'Max'
36
+
36
37
  def on_class(class_node)
37
38
  return unless test_class?(class_node)
38
39
 
@@ -116,9 +116,9 @@ module RuboCop
116
116
 
117
117
  @processed_source = parse_source!(expected_annotations.plain_source, file)
118
118
 
119
- offenses = _investigate(@cop, @processed_source)
119
+ @offenses = _investigate(@cop, @processed_source)
120
120
 
121
- actual_annotations = expected_annotations.with_offense_annotations(offenses)
121
+ actual_annotations = expected_annotations.with_offense_annotations(@offenses)
122
122
 
123
123
  assert_equal(expected_annotations.to_s, actual_annotations.to_s)
124
124
  end
@@ -143,7 +143,7 @@ module RuboCop
143
143
  break corrected_source if @last_corrector.empty? || corrected_source == @processed_source.buffer.source
144
144
 
145
145
  if iteration > RuboCop::Runner::MAX_ITERATIONS
146
- raise RuboCop::Runner::InfiniteCorrectionLoop.new(@processed_source.path, [])
146
+ raise RuboCop::Runner::InfiniteCorrectionLoop.new(@processed_source.path, [@offenses])
147
147
  end
148
148
 
149
149
  # Prepare for next loop
@@ -155,6 +155,20 @@ module RuboCop
155
155
  assert_equal(correction, new_source)
156
156
  end
157
157
 
158
+ def assert_no_corrections
159
+ raise '`assert_no_corrections` must follow `assert_offense`' unless @processed_source
160
+
161
+ return if @last_corrector.empty?
162
+
163
+ # This is just here for a pretty diff if the source actually got changed
164
+ new_source = @last_corrector.rewrite
165
+ assert_equal(@processed_source.buffer.source, new_source)
166
+
167
+ # There is an infinite loop if a corrector is present that did not make
168
+ # any changes. It will cause the same offense/correction on the next loop.
169
+ raise RuboCop::Runner::InfiniteCorrectionLoop.new(@processed_source.path, [@offenses])
170
+ end
171
+
158
172
  def setup_assertion
159
173
  RuboCop::Formatter::DisabledConfigFormatter.config_to_allow_offenses = {}
160
174
  RuboCop::Formatter::DisabledConfigFormatter.detected_styles = {}
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Minitest
5
5
  # This module holds the RuboCop Minitest version information.
6
6
  module Version
7
- STRING = '0.35.0'
7
+ STRING = '0.35.1'
8
8
 
9
9
  def self.document_version
10
10
  STRING.match('\d+\.\d+').to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-minitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.35.0
4
+ version: 0.35.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2024-03-10 00:00:00.000000000 Z
13
+ date: 2024-07-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop