lib/rubocop/cop/rspec/message_spies.rb in rubocop-rspec-2.11.1 vs lib/rubocop/cop/rspec/message_spies.rb in rubocop-rspec-2.12.0
- old
+ new
@@ -6,24 +6,30 @@
# Checks that message expectations are set using spies.
#
# This cop can be configured in your configuration using the
# `EnforcedStyle` option and supports `--auto-gen-config`.
#
- # @example `EnforcedStyle: have_received`
+ # @example `EnforcedStyle: have_received` (default)
#
# # bad
# expect(foo).to receive(:bar)
+ # do_something
#
# # good
+ # allow(foo).to receive(:bar) # or use instance_spy
+ # do_something
# expect(foo).to have_received(:bar)
#
# @example `EnforcedStyle: receive`
#
# # bad
+ # allow(foo).to receive(:bar)
+ # do_something
# expect(foo).to have_received(:bar)
#
# # good
# expect(foo).to receive(:bar)
+ # do_something
#
class MessageSpies < Base
include ConfigurableEnforcedStyle
MSG_RECEIVE = 'Prefer `receive` for setting message expectations.'