Skip to content

Commit 23ca27c

Browse files
authored
Fix "better" code in RSpec/MessageChain cop
The original code results in an error, `receive` takes a single argument of the method name. ``` NoMethodError: undefined method `to_sym' for {:bar=>#<Thing:0x00007ff34792c178 @baz=42>}:Hash Did you mean? to_s to_set ```
1 parent 0763ad7 commit 23ca27c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rubocop/cop/rspec/message_chain.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module RSpec
1111
#
1212
# # better
1313
# thing = Thing.new(baz: 42)
14-
# allow(foo).to receive(bar: thing)
14+
# allow(foo).to receive(:bar).and_return(thing)
1515
#
1616
class MessageChain < Cop
1717
MSG = 'Avoid stubbing using `%<method>s`.'

0 commit comments

Comments
 (0)