lib/rubocop/cop/rspec/be_eql.rb in rubocop-rspec-1.12.0 vs lib/rubocop/cop/rspec/be_eql.rb in rubocop-rspec-1.13.0
- old
+ new
@@ -32,25 +32,21 @@
# `a == b`, and `b` is comparable by identity, `a` is still not
# necessarily the same type as `b` since the `#==` operator can
# coerce objects for comparison.
#
class BeEql < Cop
- MSG = 'Prefer `be` over `eql`'.freeze
+ 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?}))
PATTERN
def on_send(node)
- eql_type_with_identity(node) do |eql|
- add_offense(eql, :selector, MSG)
- end
+ eql_type_with_identity(node) { |eql| add_offense(eql, :selector) }
end
def autocorrect(node)
- lambda do |corrector|
- corrector.replace(node.loc.selector, 'be')
- end
+ ->(corrector) { corrector.replace(node.loc.selector, 'be') }
end
end
end
end
end