File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1414- Fix a false positive for ` RSpec/PendingWithoutReason ` when ` skip ` is passed a block inside example. ([ @ydah ] , [ @pirj ] )
1515- Rename ` RSpec/PendingBlockInsideExample ` cop to ` RSpec/SkipBlockInsideExample ` . ([ @pirj ] )
1616- Deprecate ` send_pattern ` /` block_pattern ` /` numblock_pattern ` helpers in favour of using node pattern explicitly. ([ @pirj ] , [ @ydah ] )
17+ - Fix an incorrect autocorrect for ` RSpec/VerifiedDoubleReference ` when namespaced class. ([ @ydah ] )
1718
1819## 2.18.1 (2023-01-19)
1920
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ def on_send(node)
7979 expression = class_reference . source_range
8080
8181 add_offense ( expression , message : message ) do |corrector |
82- violation = class_reference . children . last . to_s
82+ violation = class_reference . source
8383 corrector . replace ( expression , correct_style ( violation ) )
8484
8585 opposite_style_detected
@@ -102,7 +102,7 @@ def correct_style(violation)
102102 if style == :string
103103 "'#{ violation } '"
104104 else
105- violation
105+ violation . gsub ( /^['"]|['"]$/ , '' )
106106 end
107107 end
108108 end
Original file line number Diff line number Diff line change 2727 expect_offense ( <<~RUBY , verified_double : verified_double )
2828 %{verified_double}('ClassName')
2929 _{verified_double} ^^^^^^^^^^^ Use a constant class reference for verified doubles.
30+ %{verified_double}('Foo::Bar::Baz')
31+ _{verified_double} ^^^^^^^^^^^^^^^ Use a constant class reference for verified doubles.
32+ %{verified_double}('::Foo::Bar')
33+ _{verified_double} ^^^^^^^^^^^^ Use a constant class reference for verified doubles.
3034 RUBY
3135
3236 expect_correction ( <<~RUBY )
3337 #{ verified_double } (ClassName)
38+ #{ verified_double } (Foo::Bar::Baz)
39+ #{ verified_double } (::Foo::Bar)
3440 RUBY
3541 end
3642
5258 expect_offense ( <<~RUBY , verified_double : verified_double )
5359 %{verified_double}(ClassName)
5460 _{verified_double} ^^^^^^^^^ Use a string class reference for verified doubles.
61+ %{verified_double}(Foo::Bar::Baz)
62+ _{verified_double} ^^^^^^^^^^^^^ Use a string class reference for verified doubles.
63+ %{verified_double}(::Foo::Bar)
64+ _{verified_double} ^^^^^^^^^^ Use a string class reference for verified doubles.
5565 RUBY
5666
5767 expect_correction ( <<~RUBY )
5868 #{ verified_double } ('ClassName')
69+ #{ verified_double } ('Foo::Bar::Baz')
70+ #{ verified_double } ('::Foo::Bar')
5971 RUBY
6072 end
6173
You can’t perform that action at this time.
0 commit comments