README.rdoc in faraday-0.0.1 vs README.rdoc in faraday-0.0.2
- old
+ new
@@ -52,15 +52,17 @@
=== Writing tests based on faraday
Using the MockRequest connection adapter you can implement your own test
connection class:
+ # customize your own TestConnection or just use Faraday::TestConnection
class TestConnection < Faraday::Connection
- extend Faraday::Adapter::MockRequest
+ include Faraday::Adapter::MockRequest
end
conn = TestConnection.new do |stub|
- stub.get('/hello.json', { 'hi world' }
+ # response mimics a rack response
+ stub.get('/hello.json') { [200, {}, 'hi world'] }
end
resp = conn.get '/hello.json'
resp.body # => 'hi world'
resp = conn.get '/whatever' # => <not stubbed, raises connection error>