fix but where DATA templates are not being rendered

This commit is contained in:
Graham Ollis
2013-01-27 22:48:55 -05:00
parent c1afea55a9
commit 408cba6c35
6 changed files with 56 additions and 7 deletions
+7 -3
View File
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 6;
use Test::More tests => 9;
use Test::Mojo;
use File::Temp qw( tempdir );
@@ -11,7 +11,7 @@ app->plugin(
tt_renderer => {
template_options => {
# These options are specific to TT
INCLUDE_PATH => 'templates',
#INCLUDE_PATH => 'templates',
COMPILE_DIR => tempdir( CLEANUP => 1 ),
COMPILE_EXT => '.ttc',
# ... anything else to be passed on to TT should go here
@@ -27,6 +27,8 @@ get '/' => sub {
get '/bar' => 'bar';
get '/grimlock' => 'grimlock';
my $t = Test::Mojo->new;
$t->get_ok('/')
@@ -37,7 +39,9 @@ $t->get_ok('/bar')
->status_is(200)
->content_like(qr{bar});
#note $t->tx->res->to_string;
$t->get_ok('/grimlock')
->status_is(200)
->content_like(qr{King});
__DATA__
+7 -3
View File
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 6;
use Test::More tests => 9;
use Test::Mojo;
use File::Temp qw( tempdir );
use FindBin '$Bin';
@@ -13,7 +13,7 @@ my $tt = Mojolicious::Plugin::TtRenderer::Engine->build(
template_options => {
UNICODE => 1,
ENCODING => 'UTF-8',
INCLUDE_PATH => "$Bin/templates",
#INCLUDE_PATH => "$Bin/templates",
COMPILE_DIR => tempdir( CLEANUP => 1 ),
}
);
@@ -27,6 +27,8 @@ get '/' => sub {
get '/bar' => 'bar';
get '/grimlock' => 'grimlock';
my $t = Test::Mojo->new;
$t->get_ok('/')
@@ -37,7 +39,9 @@ $t->get_ok('/bar')
->status_is(200)
->content_like(qr{bar});
#note $t->tx->res->to_string;
$t->get_ok('/grimlock')
->status_is(200)
->content_like(qr{King});
__DATA__
+37
View File
@@ -0,0 +1,37 @@
use strict;
use warnings;
use File::Temp qw( tempdir );
BEGIN { $ENV{MOJO_HOME} = tempdir( CLEANUP => 1) }
use Test::More tests => 6;
use Test::Mojo;
use Mojolicious::Lite;
plugin 'tt_renderer';
app->renderer->default_handler('tt');
get '/' => sub {
die 'foo';
};
get '/bar' => 'bar';
my $t = Test::Mojo->new;
$t->get_ok('/')
->status_is(500)
->content_like(qr{foo});
$t->get_ok('/bar')
->status_is(200)
->content_like(qr{bar});
#note $t->tx->res->to_string;
__DATA__
@@ index.html.tt
anything
@@ bar.html.tt
sometimes, the bar, he eats you...
+1
View File
@@ -0,0 +1 @@
Me Grimlock King!