add a small example to README #190

Merged
merged 1 commit into from Oct 8, 2012
Jump to file
+13 −0
Split
View
@@ -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