Created
February 12, 2012 18:45
-
-
Save memowe/1810171 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojo::Base -strict; | |
use Test::More tests => 8; | |
use Test::Mojo; | |
use Mojolicious::Lite; | |
use FindBin; | |
get '/first' => {template => '23'}; | |
get '/second' => {template => '42'}; | |
# Create tester | |
my $t = Test::Mojo->new; | |
# Found 23 in default template directory | |
$t->get_ok('/first')->status_is(200)->content_like(qr/^23$/); | |
# template2/42 not found | |
$t->get_ok('/second')->status_is(404); | |
# Add second template root and refresh templates cache | |
push @{$t->app->renderer->roots}, "$FindBin::Bin/templates2"; | |
delete $t->app->renderer->{templates}; | |
# Found 42 in template2 directory | |
$t->get_ok('/second')->status_is(200)->content_like(qr/^42$/); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment