What is the best way to do this now with unit tests?

In the past we would do something like this, but it is really obsolete with ColdBox 3.0 Rc1+ or am I doing this wrong?

var event = getRequestContext();

event.setValue(“exceptionBean”,exceptionBean);

but I would prefer something more like this, is this still available with the above method somehow?

var rc = instance.event.getCollection();

rc.spaceUrl = ‘AndyScott’;

//Setup the form to test for a valid comment

var form = {

name = ‘Andrew Scott’,

email = ‘andy@stiff.com.ua’,

website = ‘’,

comment = ‘weeeeeee’,

rememberInfo = false,

commentSubscribe = false,

blogEntryId = 1

};

event = execute(‘blog:blogComment.index’);

I am very well aware that the form needs to be added to the RequestContect in a different manner, but I have tried using the above as

var rc = {

name = ‘Andrew Scott’,

email = ‘andy@stiff.com.ua’,

website = ‘’,

comment = ‘weeeeeee’,

rememberInfo = false,

commentSubscribe = false,

blogEntryId = 1

So it adds the stuff to the RC, but it still fails when calling the event. Any help and direction would much be appreciated here.

Regards,

Andrew Scott

http://www.andyscott.id.au/

I have not tried that approach. It seems to me, you are trying to put things in the RC before ColdBox has captured the request, which, is why it won’t exist yet.

You should be able to keep things easy and put all your vars in the URL scope. ColdBox merges the FORM and URL scopes into the RC when you call the Execute() method. Finally, after the Execute method is called you can use the Event object normally: i.e.: “rc = Event.getCollection();”

Aaron is correct. Put them in the URL scope and it should work fine. That is they way I have done it.

Curt