lib/rubocop/cop/rspec/variable_name.rb in rubocop-rspec-2.18.1 vs lib/rubocop/cop/rspec/variable_name.rb in rubocop-rspec-2.19.0
- old
+ new
@@ -40,18 +40,21 @@
#
class VariableName < Base
include ConfigurableNaming
include AllowedPattern
include Variable
+ include InsideExampleGroup
MSG = 'Use %<style>s for variable names.'
def on_send(node)
+ return unless inside_example_group?(node)
+
variable_definition?(node) do |variable|
return if variable.dstr_type? || variable.dsym_type?
return if matches_allowed_pattern?(variable.value)
- check_name(node, variable.value, variable.loc.expression)
+ check_name(node, variable.value, variable.source_range)
end
end
private