[Catalyst] writing a test suite for my app
    Matt S Trout 
    dbix-class at trout.me.uk
       
    Sun May 14 23:49:10 CEST 2006
    
    
  
Daniel McBrearty wrote:
> OK, some questions ... not all are really catalyst things, just holes in 
> my knowledge, but still ...
> 
> 1. I have a redirect in my root ...
> 
> sub default : Private {
>     my ( $self, $c ) = @_;
>     $c->response->redirect('/public/home');
> }
> 
> I can test that this is a redirect in 01app.t ...
> 
> ok( request('/')->is_redirect, 'root redirects' );
> 
> but how do I test where it redirects to?
Hang onto the response object returned from request() and check the 
Location: header
> 2. in my attempt to work out the above, I tried inserting ...
> 
> print "CONTENT IS:".request('/')->content."\n";
> 
> in the test file ... but I never see the output? why? how do I do 
> something like this to in a .t file?
If you run the test with
perl -Ilib t/foo.t
that should do the trick.
> 3. why does this :
> 
> ok( request('public/index')->is_success, 'Request should succeed' );
> 
> get seen as a request to "index" in my controller? (I thought the "/" 
> really belonged to the root eg localhost:3000/ ... so if anything I'd 
> have expected /public/index to be a problem ...)
Without seeing the controller, not sure.
    
    
More information about the Catalyst
mailing list