Created
March 17, 2010 18:11
-
-
Save sharifulin/335531 to your computer and use it in GitHub Desktop.
Nested layouts for the Mojolicious
This file contains hidden or 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
#!/usr/bin/env perl | |
use Mojolicious::Lite; | |
get '/' => 'index'; | |
get '/ok' => 'index_ok'; | |
use Test::More; | |
plan tests => 6; | |
use Test::Mojo; | |
my $result = "<!doctype html><html>\n<head><title>Funky!</title></head>\n<body>\nYea baby!\n\n</body>\n</html>\n"; | |
my $t = Test::Mojo->new; | |
$t->get_ok('/ok')->status_is(200)->content_is($result); | |
$t->get_ok('/' )->status_is(200)->content_is($result); | |
__DATA__ | |
@@ index.html.ep | |
% layout 'funky'; | |
Yea baby! | |
@@ layouts/funky.html.ep | |
% layout 'base'; | |
<head><title>Funky!</title></head> | |
<body> | |
<%== content %> | |
</body> | |
@@ layouts/base.html.ep | |
<!doctype html><html> | |
<%== content %> | |
</html> | |
@@ index_ok.html.ep | |
% layout 'funky_base'; | |
Yea baby! | |
@@ layouts/funky_base.html.ep | |
<!doctype html><html> | |
<head><title>Funky!</title></head> | |
<body> | |
<%== content %> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What he said? Why this doesn't work?