Fixed double TT rendering on error

If a template produced a rendering error in process() but did not produce one
when called without stash variables, the Mojo::Exception would be built
incorrectly, leading to an exception that masked the original error.
This commit is contained in:
Matthias Bethke committed 2012-05-17 14:00:17 -06:00
1 parent b3c64c75d4
commit 989ea57cf9
2 files changed
+8 -5

No files matched your search

+7 -2
View File
@@ -15,7 +15,7 @@ BEGIN { $ENV{MOJO_TMPDIR} ||= File::Temp::tempdir }
# Make sure sockets are working
plan skip_all => 'working sockets required for this test!'
unless Mojo::IOLoop->new->generate_port;
plan tests => 3;
plan tests => 5;
# Leela: OK, this has gotta stop. I'm going to remind Fry of his humanity the way only a woman can.
# Farnsworth: You're going to do his laundry?
@@ -30,13 +30,18 @@ plugin 'tt_renderer';
app->log->level('error');
# GET /
get '/' => 'index';
get '/' => 'index';
get '/blow' => sub {
shift->render(template => 'conditional-exception', do_process => 1);
};
my $t = Test::Mojo->new;
# Simple TT template
$t->get_ok('/')->status_is(200)
->content_like(qr/test123456/);
$t->get_ok('/blow')->content_like(qr/file error - doesnotexist.tt: No such file or directory/);
eval "
use Devel::Cycle 'find_cycle';