From: John Mettraux Date: 2008-05-27T08:23:14+09:00 Subject: Re: Unit testing an HTTP client On Tue, May 27, 2008 at 7:59 AM, Tobias Weber wrote: > Hi, > my programm uses the HTTPClient gem to call a backend that was > originally made for AJAX-without-the-X. Mainly it does POST without > expecting any result. > > How do you test this? Hello Tobias, I've been through the same routine for an http client (http://rufus.rubyforge.org/rufus-verbs). I've written a test server based on Webrick just for the unit tests : http://github.com/jmettraux/rufus-verbs/tree/master/test/items.rb (see the class ItemServer as a starting point). It's then used in the startup/teadown of my unit tests : http://github.com/jmettraux/rufus-verbs/tree/master/test/testbase.rb Maybe that'll inspire you. Webrick comes with Ruby, it's quite handy. You don't have to worry about threads [for now], the server will run in its own. I'm sure someone else will come with an even better piece of advice. Freundliche Gruesse, -- John Mettraux - http://jmettraux.wordpress.com