rubocop-rspec 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/lib/rubocop/cop/rspec/around_block.rb +2 -4
- data/lib/rubocop/cop/rspec/empty_metadata.rb +1 -0
- data/lib/rubocop/cop/rspec/mixin/top_level_group.rb +7 -0
- data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +3 -4
- data/lib/rubocop/cop/rspec/stubbed_mock.rb +12 -9
- data/lib/rubocop/cop/rspec/unspecified_exception.rb +0 -1
- data/lib/rubocop/rspec/hook.rb +1 -1
- data/lib/rubocop/rspec/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ca108a17fe360c345896a230b0bec34f36430cfff3eb7b06d9fd28fa302da06
|
4
|
+
data.tar.gz: 8eaf93b36c0cf29b2718e86fc8d99e85601f517966d008fd00d53f4315cd1745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3375145facfb2e91f2cfee6949544947756e965f23fd713a09aba5f301b8558dc40be1b9cc3a66cb629c2b14f643a8bfb9aab12bff509dcfbcb2f9b05e801ac
|
7
|
+
data.tar.gz: 75ea9be799c2868fbc4b7333b20d95ecf3934f0d8d38339c9c412010b037811cb2d45b2c3e494e01ea6f1be3619ac39290c22af5b1b76cc75a3ec0e0c3a9f6c3
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## Master (Unreleased)
|
4
4
|
|
5
|
+
## 3.3.0 (2024-12-12)
|
6
|
+
|
7
|
+
- Deprecate `top_level_group?` method from `TopLevelGroup` mixin as all of its callers were intentionally removed from `Rubocop/RSpec`. ([@corsonknowles])
|
8
|
+
- Fix false positive for RSpec/EmptyMetadata for splat kwargs. ([@pirj])
|
9
|
+
|
5
10
|
## 3.2.0 (2024-10-26)
|
6
11
|
|
7
12
|
- Fix `RSpec/VoidExpect` to only operate inside an example block. ([@corsonknowles])
|
@@ -740,7 +745,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
740
745
|
## 1.13.0 (2017-03-07)
|
741
746
|
|
742
747
|
- Add repeated 'it' detection to `RSpec/ExampleWording` cop. ([@dgollahon])
|
743
|
-
- Add
|
748
|
+
- Add [observed_nesting/max_nesting] info to `RSpec/NestedGroups` messages. ([@dgollahon])
|
744
749
|
- Add `RSpec/ItBehavesLike` cop. ([@dgollahon])
|
745
750
|
- Add `RSpec/SharedContext` cop. ([@Darhazer])
|
746
751
|
- `RSpec/MultipleExpectations`: Count aggregate_failures block as single expectation. ([@Darhazer])
|
@@ -69,15 +69,13 @@ module RuboCop
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def check_for_unused_proxy(block, proxy)
|
72
|
-
name, = *proxy
|
73
|
-
|
74
72
|
find_arg_usage(block) do |usage|
|
75
|
-
return if usage.include?(s(:lvar, name))
|
73
|
+
return if usage.include?(s(:lvar, proxy.name))
|
76
74
|
end
|
77
75
|
|
78
76
|
add_offense(
|
79
77
|
proxy,
|
80
|
-
message: format(MSG_UNUSED_ARG, arg: name)
|
78
|
+
message: format(MSG_UNUSED_ARG, arg: proxy.name)
|
81
79
|
)
|
82
80
|
end
|
83
81
|
|
@@ -7,6 +7,10 @@ module RuboCop
|
|
7
7
|
module TopLevelGroup
|
8
8
|
extend RuboCop::NodePattern::Macros
|
9
9
|
|
10
|
+
DEPRECATED_MODULE_METHOD_WARNING =
|
11
|
+
'top_level_group? is deprecated and will be ' \
|
12
|
+
'removed in the next major version of rubocop_rspec.'
|
13
|
+
|
10
14
|
def on_new_investigation
|
11
15
|
super
|
12
16
|
|
@@ -28,7 +32,10 @@ module RuboCop
|
|
28
32
|
|
29
33
|
def on_top_level_group(_node); end
|
30
34
|
|
35
|
+
# @private
|
36
|
+
# @deprecated All callers of this method have been removed.
|
31
37
|
def top_level_group?(node)
|
38
|
+
warn DEPRECATED_MODULE_METHOD_WARNING, uplevel: 1
|
32
39
|
top_level_groups.include?(node)
|
33
40
|
end
|
34
41
|
|
@@ -67,11 +67,10 @@ module RuboCop
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def autocorrect_hash_arg(corrector, arg)
|
70
|
-
|
71
|
-
|
72
|
-
corrector.replace(arg, key_to_arg(key))
|
70
|
+
pair = arg.pairs.first
|
71
|
+
corrector.replace(arg, key_to_arg(pair.key))
|
73
72
|
corrector.insert_after(arg.parent.loc.end,
|
74
|
-
".and_return(#{value.source})")
|
73
|
+
".and_return(#{pair.value.source})")
|
75
74
|
end
|
76
75
|
|
77
76
|
def autocorrect_array_arg(corrector, arg)
|
@@ -14,8 +14,9 @@ module RuboCop
|
|
14
14
|
# expect(foo).to receive(:bar).with(42)
|
15
15
|
#
|
16
16
|
class StubbedMock < Base
|
17
|
-
MSG = 'Prefer
|
17
|
+
MSG = 'Prefer %<replacement>s over `%<method_name>s` when ' \
|
18
18
|
'configuring a response.'
|
19
|
+
RESTRICT_ON_SEND = %i[to].freeze
|
19
20
|
|
20
21
|
# @!method message_expectation?(node)
|
21
22
|
# Match message expectation matcher
|
@@ -133,8 +134,6 @@ module RuboCop
|
|
133
134
|
}
|
134
135
|
PATTERN
|
135
136
|
|
136
|
-
RESTRICT_ON_SEND = %i[to].freeze
|
137
|
-
|
138
137
|
def on_send(node)
|
139
138
|
expectation(node) do |expectation, method_name, matcher|
|
140
139
|
on_expectation(expectation, method_name, matcher)
|
@@ -155,19 +154,23 @@ module RuboCop
|
|
155
154
|
end
|
156
155
|
|
157
156
|
def msg(method_name)
|
158
|
-
format(
|
159
|
-
|
160
|
-
|
157
|
+
format(
|
158
|
+
MSG,
|
159
|
+
method_name: method_name,
|
160
|
+
replacement: replacement(method_name)
|
161
|
+
)
|
161
162
|
end
|
162
163
|
|
163
164
|
def replacement(method_name)
|
164
165
|
case method_name
|
165
166
|
when :expect
|
166
|
-
|
167
|
+
'`allow`'
|
167
168
|
when :is_expected
|
168
|
-
'allow(subject)'
|
169
|
+
'`allow(subject)`'
|
169
170
|
when :expect_any_instance_of
|
170
|
-
|
171
|
+
'`allow_any_instance_of`'
|
172
|
+
else
|
173
|
+
'an allow statement'
|
171
174
|
end
|
172
175
|
end
|
173
176
|
end
|
data/lib/rubocop/rspec/hook.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Backus
|
8
8
|
- Ian MacLeod
|
9
9
|
- Nils Gemeinhardt
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-12-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -193,7 +193,7 @@ metadata:
|
|
193
193
|
changelog_uri: https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md
|
194
194
|
documentation_uri: https://docs.rubocop.org/rubocop-rspec/
|
195
195
|
rubygems_mfa_required: 'true'
|
196
|
-
post_install_message:
|
196
|
+
post_install_message:
|
197
197
|
rdoc_options: []
|
198
198
|
require_paths:
|
199
199
|
- lib
|
@@ -208,8 +208,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
- !ruby/object:Gem::Version
|
209
209
|
version: '0'
|
210
210
|
requirements: []
|
211
|
-
rubygems_version: 3.5.
|
212
|
-
signing_key:
|
211
|
+
rubygems_version: 3.5.22
|
212
|
+
signing_key:
|
213
213
|
specification_version: 4
|
214
214
|
summary: Code style checking for RSpec files
|
215
215
|
test_files: []
|