File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed
Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 33## Master (Unreleased)
44
55- Add new cop ` RSpec/LeakyLocalVariable ` . ([ @lovro-bikic ] )
6+ - Fix detection of nameless doubles with methods in ` RSpec/VerifiedDoubles ` . ([ @ushi-as ] )
67
78## 3.7.0 (2025-09-01)
89
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ class VerifiedDoubles < Base
3434
3535 def on_send ( node )
3636 unverified_double ( node ) do |name , *_args |
37- return if name . nil? && cop_config [ 'IgnoreNameless' ]
37+ return if ( name . nil? || hash? ( name ) ) && cop_config [ 'IgnoreNameless' ]
3838 return if symbol? ( name ) && cop_config [ 'IgnoreSymbolicNames' ]
3939
4040 add_offense ( node )
@@ -46,6 +46,10 @@ def on_send(node)
4646 def symbol? ( name )
4747 name &.sym_type?
4848 end
49+
50+ def hash? ( arg )
51+ arg &.hash_type?
52+ end
4953 end
5054 end
5155 end
Original file line number Diff line number Diff line change 7474 RUBY
7575 end
7676
77+ it 'ignores doubles that have no name but methods specified' do
78+ expect_no_offenses ( <<~RUBY )
79+ it do
80+ foo = double(call: :bar)
81+ end
82+ RUBY
83+ end
84+
7785 it 'ignores instance_doubles' do
7886 expect_no_offenses ( <<~RUBY )
7987 it do
You can’t perform that action at this time.
0 commit comments