[Catalyst] problem with basic test of auto-generated TTSite code

Leandro Hermida softdev at leandrohermida.com
Tue Jul 27 14:07:44 GMT 2010


Hi all,

Sorry if this is a newbie question, I am having a problem writing a
basic test for Catalyst::Helper::View::TTSite generated code.  I did
the following:

./script/myapp_create.pl view TT TTSite

which creates the following package:

package MyApp::View::TT;

use strict;
use base 'Catalyst::View::TT';

__PACKAGE__->config({
    INCLUDE_PATH => [
        MyApp->path_to( 'root', 'src' ),
        MyApp->path_to( 'root', 'lib' )
    ],
    PRE_PROCESS  => 'config/main',
    WRAPPER      => 'site/wrapper',
    ERROR        => 'error.tt2',
    TIMER        => 0,
    render_die   => 1,
});

If I create a basic test for this t/view_TT.t that looks like this:

use strict;
use warnings;
use Test::More;

BEGIN { use_ok 'MyApp::View::TT' }

done_testing();

I get the following error when test:

#   Failed test 'use MyApp::View::TT;'
#   at t/view_TT.t line 5.
#     Tried to use 'MyApp::View::TT'.
#     Error:  Can't locate object method "path_to" via package "MyApp"
at /home/lhermida/work/workspaces/catalyst/MyApp/lib/MyApp/View/TT.pm
line 6.

Is it because at compile time MyApp doesn't have the path_to() method?
 How should I write the test?

not sure,
Leandro



More information about the Catalyst mailing list