From: Brian Candler Date: 2003-07-30T22:53:58+09:00 Subject: Re: How to unit test CGI methods? On Wed, Jul 30, 2003 at 10:08:35PM +0900, David Heinemeier Hansson wrote: > I've added a number of methods to the CGI class that I'd like to unit > test, but CGI.new insists on prompting for parameter pairs, which > nullifies automation. Currently, I'm using an unelegant work-around by > keeping all the new methods in a CGIMethods class that I can test. I > then have a set of wrappers in the actual CGI extension. But it feels > wrong. > > Is there any way to automate the parameter pairs for CGI.new? Have a look at the source of ruby-fcgi from RAA (lib/fcgi.rb, class FCGI). It subclasses CGI to generate a new class like CGI but which gets its parameters from elsewhere. It would save hassle if CGI had a class method to do this though :-) Cheers, Brian.