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 3
3
## Master (Unreleased)
4
4
5
5
* Add missing documentation for ` single_statement_only ` style of ` RSpec/ImplicitSubject ` cop. ([ @tejasbubane ] [ ] )
6
+ * Fix an exception in ` DescribedClass ` when accessing a constant on a variable in a spec that is nested in a namespace. ([ @rrosenblum ] [ ] )
6
7
7
8
## 2.3.0 (2021-04-28)
8
9
@@ -615,3 +616,4 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
615
616
[ @hosamaly ] : https://github.com/hosamaly
616
617
[ @stephannv ] : https://github.com/stephannv
617
618
[ @Tietew ] : https://github.com/Tietew
619
+ [ @rrosenblum ] : https://github.com/rrosenblum
Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ def const_name(node)
203
203
[ name ]
204
204
elsif namespace . const_type?
205
205
[ *const_name ( namespace ) , name ]
206
- elsif namespace . lvar_type? || namespace . cbase_type?
206
+ elsif %i[ lvar cbase send ] . include? ( namespace . type )
207
207
[ nil , name ]
208
208
end
209
209
end
Original file line number Diff line number Diff line change 77
77
RUBY
78
78
end
79
79
80
+ it 'allows accessing constants from variables when in a nested namespace' do
81
+ expect_no_offenses ( <<~RUBY )
82
+ module Foo
83
+ describe MyClass do
84
+ let(:foo) { SomeClass }
85
+ let(:baz) { foo::CONST }
86
+ end
87
+ end
88
+ RUBY
89
+ end
90
+
80
91
it 'flags with metadata' do
81
92
expect_offense ( <<-RUBY )
82
93
describe MyClass, some: :metadata do
You can’t perform that action at this time.
0 commit comments