Nathan Gray wrote:
> I would like to test a model with a unit test.  Catalyst kindly
> generates stub unit tests for models, but it does not include a stub
> showing how to instantiate the context object.
>
>   
I think I mentioned this on another thread earlier on. Something about
Chuck Norris if memory serves. Anyway:

my $controller = MyApp->controller('MyController');
my $c = MyApp->prepare();

# Monkey with $c to set up a fake context (set req->uri, or params)

my $result = $c->forward($controller, 'method_to_test', [EMAIL PROTECTED]);


Matt


_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to