[Catalyst] writing a test suite for my app

Daniel McBrearty danielmcbrearty at gmail.com
Sun May 14 23:34:03 CEST 2006


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?

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?

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 ...)

thanks

Daniel





On 5/12/06, Daniel McBrearty <danielmcbrearty at gmail.com> wrote:
>
> thanks. Had a look at the sample pages on Amazon, looks good. I'll pick a
> copy up, along with Mark Dominus' book which has also got my interest.
>
>
>
> On 5/12/06, Len Jaffe <lenjaffe at jaffesystems.com> wrote:
> >
> >
> > > Daniel McBrearty <danielmcbrearty at gmail.com> wrote:
> > > Gavin, is this the one you mean? looks good.
> > >
> > >
> >
> > http://www.amazon.com/gp/product/0596100922/103-9488582-4915043?v=glance&n=283155
> >
> >
> > This is a good book. I won a copy from perlcast.com
> > and uits worth every penny :-)
> >
> > seriously, this is a well wretten book, full of
> > practical perl testing with Test::* modules.
> >
> > It will show code, then have a section called "what
> > just happened" to explain the whys and wherefors.
> > There is a chapter on Test::MockObject. Their killer
> > app exemple for Test::MockObject is to have an object
> > to pretend to be a DBI/DBD connection, without really
> > having a db around.
> >
> > Len.
> > Unpaid endorser of good stuff.
> >
> >
> >
> > _______________________________________________
> > Catalyst mailing list
> > Catalyst at lists.rawmode.org
> > http://lists.rawmode.org/mailman/listinfo/catalyst
> >
>
>
>
> --
>
> Daniel McBrearty
> email : danielmcbrearty at gmail.com
> www.engoi.com : the multi - language vocab trainer
> BTW : 0873928131
>



-- 
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060514/4006b600/attachment.htm 


More information about the Catalyst mailing list