From: Tomas Doran Date: Wed, 25 Nov 2009 21:22:17 +0000 (+0000) Subject: Fix issues, more tests X-Git-Tag: 1.21_01~1^2~25 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3d3e34a06be95dd678100234022700fe57f1fcdf;hp=2ad364470c25e803c2b8394431490622d3fb9dd7;p=catagits%2FCatalyst-Devel.git Fix issues, more tests --- diff --git a/share/lib/MyApp/Controller/Root.pm.tt b/share/lib/MyApp/Controller/Root.pm.tt index bb717a3..24795f6 100644 --- a/share/lib/MyApp/Controller/Root.pm.tt +++ b/share/lib/MyApp/Controller/Root.pm.tt @@ -20,10 +20,10 @@ __PACKAGE__->config(namespace => ''); =head1 METHODS -=cut - =head2 index +The root page (/) + =cut sub index :Path :Args(0) { @@ -33,6 +33,12 @@ sub index :Path :Args(0) { $c->response->body( $c->welcome_message ); } +=head2 default + +Standard 404 error page + +=cut + sub default :Path { my ( $self, $c ) = @_; $c->response->body( 'Page not found' ); diff --git a/share/script/myapp_server.pl.tt b/share/script/myapp_server.pl.tt index 887c191..2de85a8 100644 --- a/share/script/myapp_server.pl.tt +++ b/share/script/myapp_server.pl.tt @@ -1,7 +1,7 @@ [% startperl %] BEGIN { - $ENV{CATALYST_SCRIPT_GEN} = [% script_gen %] + $ENV{CATALYST_SCRIPT_GEN} = [% scriptgen %] } use Catalyst::ScriptRunner; diff --git a/t/generated_app.t b/t/generated_app.t index fa9cf7d..ec7e3b0 100644 --- a/t/generated_app.t +++ b/t/generated_app.t @@ -4,8 +4,9 @@ use warnings; use File::Temp qw/ tempdir tmpnam /; use File::Spec; use Test::WWW::Mechanize; +use Catalyst::Devel; -my $dir = tempdir(); # CLEANUP => 1 ); +my $dir = tempdir( CLEANUP => 1 ); my $devnull = File::Spec->devnull; use Test::More; @@ -50,19 +51,19 @@ script/testapp_test.pl script/testapp_create.pl |; -plan 'tests' => scalar @files + 4; - foreach my $fn (@files) { ok -r $fn, "Have $fn in generated app"; + if ($fn =~ /script/) { + ok -x $fn, "$fn is executable"; + } } ## Makefile stuff my $makefile_status = `$^X Makefile.PL`; ok $makefile_status, "Makefile ran okay"; ok -e "Makefile", "Makefile exists"; -my $newapp_test_status = `prove -l t/ 2> $devnull`; -ok $newapp_test_status, "Tests ran okay"; -#is $newapp_test_status, ; +my $newapp_test_status = system("make", "test"); +ok !$newapp_test_status, "Tests ran okay"; ## Moosey server tests - kmx++ my $server_path = File::Spec->catfile('script', 'testapp_server.pl'); @@ -82,4 +83,15 @@ $mech->get_ok( "http://localhost:" . $port ); kill 'KILL', $childpid; +my $server_script = do { + open(my $fh, '<', 'script/testapp_server.pl') or die $!; + local $/; + <$fh>; +}; + +ok $server_script =~ qr/CATALYST_SCRIPT_GEN}\s+=\s+(\d+)/, + 'SCRIPT_GEN found in generated output'; +is $1, $Catalyst::Devel::CATALYST_SCRIPT_GEN, 'Script gen correct'; + +done_testing;