Browse files

add a small example to README

It may be obvious, but took me a while to figure out
  • Loading branch information...
1 parent 0a3cfc2 commit 56102c1145563e4ac63c3a4794d86680dbf3ac4f @goblin goblin committed Oct 8, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 README.md
View
13 README.md
@@ -233,6 +233,19 @@ double.should_receive(:msg) do |arg|
end
```
+If the method being stubbed itself takes a block, and you need to yield to it
+in some special way, you can use this:
+
+```ruby
+double.should_receive(:msg) do |&arg|
+ begin
+ arg.call
+ ensure
+ # cleanup
+ end
+end
+```
+
## Combining Expectation Details
Combining the message name with specific arguments, receive counts and responses

0 comments on commit 56102c1

Please sign in to comment.