On Sun, 5 Nov 2006 13:29:00 -0800
Ezra Zygmuntowicz <[EMAIL PROTECTED]> wrote:

> Hey Folks-
> 
>       I'm trying to setup a new test/spec harness for testing Merb. I was  
> wondering if there is a way to mock the Mongrel request, response  
> objects easily to test my handler without actually running a server?  
> I can easily do the env hash but I'm not entirely sure what needs to  
> go in the request StringIO object that gets passed into my mongrel  
> handler's #process method. Is there a good way to do this? Or should  
> I just fire up a server and use net/http to test it?

It's pretty easy until you get to the StringIO.  Basically, you put whatever 
encoded data would go into the body of the request.  So, multipart mime, form 
posts, etc.

You *might* be able to steal some of that from say RFuzz and then do an 
internal mock kind of thing.

Normally though, I just use rfuzz to write an external testing setup and skip 
the mock stuff completely.

-- 
Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu
http://www.zedshaw.com/
http://safari.oreilly.com/0321483502 -- The Mongrel Book
http://mongrel.rubyforge.org/
http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.
_______________________________________________
Mongrel-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to