Forum: Ruby on Rails [ANN] FakeWeb test helper for Net::HTTP / open-uri web reque

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Blaine C. (Guest)
on 2006-05-24 03:38
(Received via mailing list)
Hey All,

I've posted the first release of FakeWeb, a little library to help
with all your http client testing needs. This helper makes it trivial
to setup an idempodent environment for you to test any web service
requests in your applications.

Available on RubyForge,

== Overview
* Force Net::HTTP (and any dependent libraries, e.g. open-uri) to
return arbitrary responses or exceptions for a given set of request
* Speed up tests that involve remote HTTP round trips.
* 100% C0 test coverage as reported by rcov
* Works for all regular HTTP requests, as well as Proxied and HTTPS

== Two-line Example
FakeWeb.register_uri("", :string => "Hello World")
open("").string # => "Hello World"

== Another Example
FakeWeb.register_uri("", :response => `curl -i`)
Net::HTTP.get_response("", "/") # => Net::HTTPResponse
equivalent to fetching

Versions 1.0.0 and 1.1.0 are available, the former works with Ruby
1.8.2, and the latter (and all subsequent releases) works with Ruby

See for more information and
This topic is locked and can not be replied to.