lib/rubocop/cop/rspec/instance_variable.rb in rubocop-rspec-2.2.0 vs lib/rubocop/cop/rspec/instance_variable.rb in rubocop-rspec-2.3.0
- old
+ new
@@ -50,22 +50,26 @@
include TopLevelGroup
MSG = 'Avoid instance variables – use let, ' \
'a method call, or a local variable (if possible).'
+ # @!method dynamic_class?(node)
def_node_matcher :dynamic_class?, <<-PATTERN
(block (send (const nil? :Class) :new ...) ...)
PATTERN
+ # @!method custom_matcher?(node)
def_node_matcher :custom_matcher?, <<-PATTERN
(block {
(send nil? :matcher sym)
(send (const (const nil? :RSpec) :Matchers) :define sym)
} ...)
PATTERN
+ # @!method ivar_usage(node)
def_node_search :ivar_usage, '$(ivar $_)'
+ # @!method ivar_assigned?(node)
def_node_search :ivar_assigned?, '(ivasgn % ...)'
def on_top_level_group(node)
ivar_usage(node) do |ivar, name|
next if valid_usage?(ivar)