Skip to content
Browse files

Added info about how to stub requests to respond with Rack app response.

  • Loading branch information...
1 parent 17bc1d9 commit c6974dba75809fb04785934a898bb28834754ca2 @bblimke committed Jul 31, 2011
Showing with 12 additions and 0 deletions.
  1. +12 −0 README.md
View
12 README.md
@@ -219,6 +219,18 @@ You can also use WebMock outside a test framework:
RestClient.post('www.example.net', 'abc') # ===> "abc\n"
+### Rack responses
+
+ class MyRackApp
+ def self.call(env)
+ [200, {}, ["Hello"]]
+ end
+ end
+
+ stub_request(:get, "www.example.com").to_rack(MyRackApp)
+
+ RestClient.post('www.example.com') # ===> "Hello"
+
### Raising errors
#### Exception declared by class

0 comments on commit c6974db

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