lib/rubocop/cop/rspec/described_class.rb in rubocop-rspec-2.26.1 vs lib/rubocop/cop/rspec/described_class.rb in rubocop-rspec-2.27.0
- old
+ new
@@ -111,11 +111,11 @@
end
def find_usage(node, &block)
yield(node) if offensive?(node)
- return if scope_change?(node) || node.const_type?
+ return if scope_change?(node)
node.each_child_node do |child|
find_usage(child, &block)
end
end
@@ -192,10 +192,11 @@
# @example
# const_name(s(:const, nil, :C)) # => [:C]
# const_name(s(:const, s(:const, nil, :M), :C)) # => [:M, :C]
# const_name(s(:const, s(:cbase), :C)) # => [nil, :C]
def const_name(node)
- namespace, name = *node # rubocop:disable InternalAffairs/NodeDestructuring
+ namespace = node.namespace
+ name = node.short_name
if !namespace
[name]
elsif namespace.const_type?
[*const_name(namespace), name]
elsif %i[lvar cbase send].include?(namespace.type)