lib/rubocop/cop/rspec/message_spies.rb in rubocop-rspec-1.20.1 vs lib/rubocop/cop/rspec/message_spies.rb in rubocop-rspec-1.21.0
- old
+ new
@@ -29,12 +29,12 @@
MSG_RECEIVE = 'Prefer `receive` for setting message '\
'expectations.'.freeze
MSG_HAVE_RECEIVED = 'Prefer `have_received` for setting message '\
- 'expectations. Setup `%s` as a spy using `allow`'\
- ' or `instance_spy`.'.freeze
+ 'expectations. Setup `%<source>s` as a spy using '\
+ '`allow` or `instance_spy`.'.freeze
SUPPORTED_STYLES = %w[have_received receive].freeze
def_node_matcher :message_expectation, %(
(send (send nil? :expect $_) {:to :to_not :not_to} ...)
@@ -71,10 +71,10 @@
def error_message(receiver)
case style
when :receive
MSG_RECEIVE
when :have_received
- MSG_HAVE_RECEIVED % receiver.source
+ format(MSG_HAVE_RECEIVED, source: receiver.source)
end
end
end
end
end