lib/rubocop/cop/rspec/be_eql.rb in rubocop-rspec-1.18.0 vs lib/rubocop/cop/rspec/be_eql.rb in rubocop-rspec-1.19.0
- old
+ new
@@ -35,14 +35,16 @@
#
class BeEql < Cop
MSG = 'Prefer `be` over `eql`.'.freeze
def_node_matcher :eql_type_with_identity, <<-PATTERN
- (send _ :to $(send nil :eql {true false int float sym nil_type?}))
+ (send _ :to $(send nil? :eql {true false int float sym nil_type?}))
PATTERN
def on_send(node)
- eql_type_with_identity(node) { |eql| add_offense(eql, :selector) }
+ eql_type_with_identity(node) do |eql|
+ add_offense(eql, location: :selector)
+ end
end
def autocorrect(node)
->(corrector) { corrector.replace(node.loc.selector, 'be') }
end