Skip to content
Browse files

Merge pull request #190 from digital-science/readme_yield_note

add a small example to README
  • Loading branch information...
2 parents 0a3cfc2 + 56102c1 commit a337af717816af1aeefcffc03dc99df489b19549 @myronmarston myronmarston 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 a337af7

Please sign in to comment.
Something went wrong with that request. Please try again.