rubocop-rspec 3.3.0 → 3.6.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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -2
  3. data/README.md +7 -4
  4. data/config/default.yml +7 -12
  5. data/config/obsoletion.yml +5 -0
  6. data/lib/rubocop/cop/rspec/be_eq.rb +1 -1
  7. data/lib/rubocop/cop/rspec/be_eql.rb +1 -1
  8. data/lib/rubocop/cop/rspec/be_nil.rb +4 -0
  9. data/lib/rubocop/cop/rspec/change_by_zero.rb +3 -4
  10. data/lib/rubocop/cop/rspec/contain_exactly.rb +1 -0
  11. data/lib/rubocop/cop/rspec/context_wording.rb +6 -1
  12. data/lib/rubocop/cop/rspec/described_class.rb +4 -2
  13. data/lib/rubocop/cop/rspec/described_class_module_wrapping.rb +1 -1
  14. data/lib/rubocop/cop/rspec/empty_example_group.rb +6 -4
  15. data/lib/rubocop/cop/rspec/example_wording.rb +1 -3
  16. data/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb +1 -1
  17. data/lib/rubocop/cop/rspec/expect_actual.rb +1 -1
  18. data/lib/rubocop/cop/rspec/expect_change.rb +21 -2
  19. data/lib/rubocop/cop/rspec/focus.rb +15 -17
  20. data/lib/rubocop/cop/rspec/hook_argument.rb +2 -2
  21. data/lib/rubocop/cop/rspec/hooks_before_examples.rb +1 -1
  22. data/lib/rubocop/cop/rspec/implicit_expect.rb +3 -3
  23. data/lib/rubocop/cop/rspec/implicit_subject.rb +8 -0
  24. data/lib/rubocop/cop/rspec/include_examples.rb +39 -0
  25. data/lib/rubocop/cop/rspec/indexed_let.rb +2 -0
  26. data/lib/rubocop/cop/rspec/match_array.rb +1 -0
  27. data/lib/rubocop/cop/rspec/message_spies.rb +4 -0
  28. data/lib/rubocop/cop/rspec/mixin/metadata.rb +5 -8
  29. data/lib/rubocop/cop/rspec/nested_groups.rb +2 -2
  30. data/lib/rubocop/cop/rspec/no_expectation_example.rb +1 -1
  31. data/lib/rubocop/cop/rspec/pending.rb +1 -1
  32. data/lib/rubocop/cop/rspec/pending_without_reason.rb +2 -8
  33. data/lib/rubocop/cop/rspec/predicate_matcher.rb +18 -8
  34. data/lib/rubocop/cop/rspec/receive_messages.rb +1 -2
  35. data/lib/rubocop/cop/rspec/redundant_around.rb +1 -1
  36. data/lib/rubocop/cop/rspec/return_from_stub.rb +5 -4
  37. data/lib/rubocop/cop/rspec/scattered_setup.rb +10 -2
  38. data/lib/rubocop/cop/rspec/sort_metadata.rb +22 -8
  39. data/lib/rubocop/cop/rspec/variable_definition.rb +1 -1
  40. data/lib/rubocop/cop/rspec/variable_name.rb +1 -1
  41. data/lib/rubocop/cop/rspec/verified_double_reference.rb +14 -53
  42. data/lib/rubocop/cop/rspec_cops.rb +1 -1
  43. data/lib/rubocop/rspec/config_formatter.rb +4 -9
  44. data/lib/rubocop/rspec/description_extractor.rb +2 -2
  45. data/lib/rubocop/rspec/hook.rb +3 -1
  46. data/lib/rubocop/rspec/language.rb +3 -6
  47. data/lib/rubocop/rspec/plugin.rb +37 -0
  48. data/lib/rubocop/rspec/version.rb +1 -1
  49. data/lib/rubocop/rspec/wording.rb +0 -2
  50. data/lib/rubocop/rspec.rb +0 -7
  51. data/lib/rubocop-rspec.rb +1 -3
  52. metadata +28 -10
  53. data/lib/rubocop/cop/rspec/string_as_instance_double_constant.rb +0 -45
  54. data/lib/rubocop/rspec/inject.rb +0 -18
metadata CHANGED
@@ -1,31 +1,50 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Backus
8
8
  - Ian MacLeod
9
9
  - Nils Gemeinhardt
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2024-12-12 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: lint_roller
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.1'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.1'
15
28
  - !ruby/object:Gem::Dependency
16
29
  name: rubocop
17
30
  requirement: !ruby/object:Gem::Requirement
18
31
  requirements:
19
32
  - - "~>"
20
33
  - !ruby/object:Gem::Version
21
- version: '1.61'
34
+ version: '1.72'
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: 1.72.1
22
38
  type: :runtime
23
39
  prerelease: false
24
40
  version_requirements: !ruby/object:Gem::Requirement
25
41
  requirements:
26
42
  - - "~>"
27
43
  - !ruby/object:Gem::Version
28
- version: '1.61'
44
+ version: '1.72'
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.72.1
29
48
  description: |
30
49
  Code style checking for RSpec files.
31
50
  A plugin for the RuboCop code style enforcing & linting tool.
@@ -95,6 +114,7 @@ files:
95
114
  - lib/rubocop/cop/rspec/implicit_block_expectation.rb
96
115
  - lib/rubocop/cop/rspec/implicit_expect.rb
97
116
  - lib/rubocop/cop/rspec/implicit_subject.rb
117
+ - lib/rubocop/cop/rspec/include_examples.rb
98
118
  - lib/rubocop/cop/rspec/indexed_let.rb
99
119
  - lib/rubocop/cop/rspec/instance_spy.rb
100
120
  - lib/rubocop/cop/rspec/instance_variable.rb
@@ -157,7 +177,6 @@ files:
157
177
  - lib/rubocop/cop/rspec/sort_metadata.rb
158
178
  - lib/rubocop/cop/rspec/spec_file_path_format.rb
159
179
  - lib/rubocop/cop/rspec/spec_file_path_suffix.rb
160
- - lib/rubocop/cop/rspec/string_as_instance_double_constant.rb
161
180
  - lib/rubocop/cop/rspec/stubbed_mock.rb
162
181
  - lib/rubocop/cop/rspec/subject_declaration.rb
163
182
  - lib/rubocop/cop/rspec/subject_stub.rb
@@ -180,9 +199,9 @@ files:
180
199
  - lib/rubocop/rspec/example.rb
181
200
  - lib/rubocop/rspec/example_group.rb
182
201
  - lib/rubocop/rspec/hook.rb
183
- - lib/rubocop/rspec/inject.rb
184
202
  - lib/rubocop/rspec/language.rb
185
203
  - lib/rubocop/rspec/node.rb
204
+ - lib/rubocop/rspec/plugin.rb
186
205
  - lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
187
206
  - lib/rubocop/rspec/version.rb
188
207
  - lib/rubocop/rspec/wording.rb
@@ -193,7 +212,7 @@ metadata:
193
212
  changelog_uri: https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md
194
213
  documentation_uri: https://docs.rubocop.org/rubocop-rspec/
195
214
  rubygems_mfa_required: 'true'
196
- post_install_message:
215
+ default_lint_roller_plugin: RuboCop::RSpec::Plugin
197
216
  rdoc_options: []
198
217
  require_paths:
199
218
  - lib
@@ -208,8 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
227
  - !ruby/object:Gem::Version
209
228
  version: '0'
210
229
  requirements: []
211
- rubygems_version: 3.5.22
212
- signing_key:
230
+ rubygems_version: 3.6.7
213
231
  specification_version: 4
214
232
  summary: Code style checking for RSpec files
215
233
  test_files: []
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Cop
5
- module RSpec
6
- # Do not use a string as `instance_double` constant.
7
- #
8
- # @safety
9
- # This cop is unsafe because the correction requires loading the class.
10
- # Loading before stubbing causes RSpec to only allow instance methods
11
- # to be stubbed.
12
- #
13
- # @example
14
- # # bad
15
- # instance_double('User', name: 'John')
16
- #
17
- # # good
18
- # instance_double(User, name: 'John')
19
- #
20
- class StringAsInstanceDoubleConstant < Base
21
- extend AutoCorrector
22
-
23
- MSG = 'Do not use a string as `instance_double` constant.'
24
- RESTRICT_ON_SEND = %i[instance_double].freeze
25
-
26
- # @!method stringified_instance_double_const?(node)
27
- def_node_matcher :stringified_instance_double_const?, <<~PATTERN
28
- (send nil? :instance_double $str ...)
29
- PATTERN
30
-
31
- def on_send(node)
32
- stringified_instance_double_const?(node) do |args_node|
33
- add_offense(args_node) do |corrector|
34
- autocorrect(corrector, args_node)
35
- end
36
- end
37
- end
38
-
39
- def autocorrect(corrector, node)
40
- corrector.replace(node, node.value)
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module RSpec
5
- # Because RuboCop doesn't yet support plugins, we have to monkey patch in a
6
- # bit of our configuration.
7
- module Inject
8
- def self.defaults!
9
- path = CONFIG_DEFAULT.to_s
10
- hash = ConfigLoader.send(:load_yaml_configuration, path)
11
- config = RuboCop::Config.new(hash, path)
12
- puts "configuration from #{path}" if ConfigLoader.debug?
13
- config = ConfigLoader.merge_with_default(config, path)
14
- ConfigLoader.instance_variable_set(:@default_configuration, config)
15
- end
16
- end
17
- end
18
- end