Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 28131fe

Browse files
authored
Merge pull request rubocop#848 from schwern/docs/message-chain-cop
Fix RSpec/MessageChain "better" docs.
2 parents 49d616e + 5d0b0fc commit 28131fe

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/rubocop/cop/rspec/message_chain.rb

+1-1
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`.'

manual/cops_rspec.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@ allow(foo).to receive_message_chain(:bar, :baz).and_return(42)
18461846

18471847
# better
18481848
thing = Thing.new(baz: 42)
1849-
allow(foo).to receive(bar: thing)
1849+
allow(foo).to receive(:bar).and_return(thing)
18501850
```
18511851

18521852
### References

0 commit comments

Comments
 (0)