lib/rubocop/cop/rspec/instance_variable.rb in rubocop-rspec-1.8.0 vs lib/rubocop/cop/rspec/instance_variable.rb in rubocop-rspec-1.9.0
- old
+ new
@@ -45,18 +45,14 @@
# let(:foo) { [] }
# it { expect(foo).to be_empty }
# end
#
class InstanceVariable < Cop
- include RuboCop::RSpec::SpecOnly, RuboCop::RSpec::Language
-
MESSAGE = 'Use `let` instead of an instance variable'.freeze
EXAMPLE_GROUP_METHODS = ExampleGroups::ALL + SharedGroups::ALL
- def_node_matcher :spec_group?, <<-PATTERN
- (block (send _ {#{EXAMPLE_GROUP_METHODS.to_node_pattern}} ...) ...)
- PATTERN
+ def_node_matcher :spec_group?, EXAMPLE_GROUP_METHODS.block_pattern
def_node_search :ivar_usage, '$(ivar $_)'
def_node_search :ivar_assigned?, '(ivasgn % ...)'