lib/rubocop/cop/rspec/expect_change.rb in rubocop-rspec-2.3.0 vs lib/rubocop/cop/rspec/expect_change.rb in rubocop-rspec-2.4.0

- old
+ new

@@ -37,11 +37,11 @@ MSG_CALL = 'Prefer `change { %<obj>s.%<attr>s }`.' RESTRICT_ON_SEND = %i[change].freeze # @!method expect_change_with_arguments(node) def_node_matcher :expect_change_with_arguments, <<-PATTERN - (send nil? :change ({const send} nil? $_) (sym $_)) + (send nil? :change $_ (sym $_)) PATTERN # @!method expect_change_with_block(node) def_node_matcher :expect_change_with_block, <<-PATTERN (block @@ -53,12 +53,12 @@ def on_send(node) return unless style == :block expect_change_with_arguments(node) do |receiver, message| - msg = format(MSG_CALL, obj: receiver, attr: message) + msg = format(MSG_CALL, obj: receiver.source, attr: message) add_offense(node, message: msg) do |corrector| - replacement = "change { #{receiver}.#{message} }" + replacement = "change { #{receiver.source}.#{message} }" corrector.replace(node, replacement) end end end