diff --git a/lib/rubocop/cop/rails/helper_instance_variable.rb b/lib/rubocop/cop/rails/helper_instance_variable.rb index 80d7ab43a3..8e33d719e6 100644 --- a/lib/rubocop/cop/rails/helper_instance_variable.rb +++ b/lib/rubocop/cop/rails/helper_instance_variable.rb @@ -31,7 +31,7 @@ def on_ivar(node) end def on_ivasgn(node) - add_offense(node) + add_offense(node, location: :name) end end end diff --git a/spec/rubocop/cop/rails/helper_instance_variable_spec.rb b/spec/rubocop/cop/rails/helper_instance_variable_spec.rb index 7d0335191f..07322ac44e 100644 --- a/spec/rubocop/cop/rails/helper_instance_variable_spec.rb +++ b/spec/rubocop/cop/rails/helper_instance_variable_spec.rb @@ -16,7 +16,7 @@ def welcome_message expect_offense(<<-RUBY.strip_indent) def welcome_message(user) @user_name = user.name - ^^^^^^^^^^^^^^^^^^^^^^ Do not use instance variables in helpers. + ^^^^^^^^^^ Do not use instance variables in helpers. end RUBY end