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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fa273befbb36b0323044fcf035b7ee39?d=identicon&s=25 Blaine Cook (Guest)
on 2006-05-24 01: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, http://rubyforge.org/projects/fakeweb/

== Overview
* Force Net::HTTP (and any dependent libraries, e.g. open-uri) to
return arbitrary responses or exceptions for a given set of request
URLs.
* 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
requests.

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

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

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
1.8.4.

See http://fakeweb.rubyforge.org/ for more information and
documentation.
This topic is locked and can not be replied to.