Method: RuboCop::Cop::InternalAffairs::RedundantExpectOffenseArguments#on_send

Defined in:
lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb

#on_send(node) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb', line 22

def on_send(node)
  return if node.arguments.one? || !node.arguments[1]&.hash_type?

  range = node.first_argument.source_range.end.join(node.last_argument.source_range.end)

  add_offense(range) do |corrector|
    corrector.remove(range)
  end
end