File tree 3 files changed +25
-1
lines changed
3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Master (Unreleased)
4
4
5
+ - Fix a false positive for ` RSpec/DescribedClass ` when ` SkipBlocks ` is true and numblocks are used. ([ @earlopain ] )
6
+
5
7
## 3.5.0 (2025-02-16)
6
8
7
9
- Don't let ` RSpec/PredicateMatcher ` replace ` respond_to? ` with two arguments with the RSpec ` respond_to ` matcher. ([ @bquorning ] )
Original file line number Diff line number Diff line change @@ -153,7 +153,9 @@ def scope_change?(node)
153
153
end
154
154
155
155
def skippable_block? ( node )
156
- node . block_type? && !rspec_block? ( node ) && cop_config [ 'SkipBlocks' ]
156
+ return unless cop_config [ 'SkipBlocks' ]
157
+
158
+ node . any_block_type? && !rspec_block? ( node )
157
159
end
158
160
159
161
def only_static_constants?
Original file line number Diff line number Diff line change 24
24
end
25
25
RUBY
26
26
end
27
+
28
+ it 'ignores offenses within non-rspec numblocks' do
29
+ expect_offense ( <<~RUBY )
30
+ describe MyClass do
31
+ controller(ApplicationController) do
32
+ _1
33
+ bar = MyClass
34
+ end
35
+
36
+ before do
37
+ MyClass
38
+ ^^^^^^^ Use `described_class` instead of `MyClass`.
39
+
40
+ Foo.custom_block do
41
+ MyClass
42
+ end
43
+ end
44
+ end
45
+ RUBY
46
+ end
27
47
end
28
48
29
49
context 'when SkipBlocks is `false`' do
You can’t perform that action at this time.
0 commit comments