CGI testing

Norman Makoto Su wrote:

Is there a way to create a CGI object with its key, value
parameters already initialized?

NARF is a fork of cgi that I’m working on. One of our goals is to
make cgi easy to test. The api works this way:

CGI.process{ |cgi|

}

yields a cgi for use. To test, you can do

CGI.process( :out => StringIO.new,
:params => { “key” => “value” },
:cookies => { “cookie” => “monster” },
:session => { “akey” => “value” } ){ |cgi|

}

Does this seem like a nice api for testing a cgi?

NARF is obtainable via CVS at sourceforge; our project page is

The code is near ready for an alpha release; I expect to release
sometime in late August - mid September. There are api differences,
so NARF wouldn’t be a drop in replacement for cgi.rb. Just wanted to
let you know what we were working on :slight_smile:

Let me know what you think of the api,

~ Patrick