From: Samuel Tesla Date: 2003-07-06T04:28:05+09:00 Subject: Re: Unit Testing HTTP cookie handling Samuel Tesla writes: > Chad Fowler writes: > > > One thing you can do is to setup the code which you're unit testing to > > accept a cgi object as a parameter. Then, in your tests you can > > instantiate a CGI object, put the cookies you want into it and then hand > > it off to the code that you're testing. Of course, if all that code > > does is handle cookies, you don't even need a CGI object. You can pass > > in any object that responds to "cookies" with a Hash-like thing. Ruby > > is nice for doing mock objects, since all you have to do is respond to > > the right messages (but not worry about object type). > > I was thinking about doing that. What I've settled on, though, is > using WebUnit. Since I'm actually writing a full out CGI app, and > WebUnit looks pretty nice. Well, WebUnit would look pretty nice. For some reason I can't get it to play properly with Test::Unit the way my other unit tests do. I've opted to just fake the CGI object after all...it's much simpler. Any suggestions on getting WebUnit to play with Test::Unit...from the looks of it, it needs a major overhaul to work with the new way of doing things. Perhaps subclass it from Test::Unit::TestCase?