Created
August 17, 2010 02:26
-
-
Save memowe/528182 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
#!/usr/bin/env perl | |
use Test::More tests => 6; | |
use Test::Mojo; | |
use Mojolicious::Lite; | |
use File::Basename; | |
# Work without 'public' directory | |
app->static->root(app->home); | |
# Render source | |
get '/foo' => sub { shift->render_static(basename $0) }; | |
get '/bar' => sub { shift->render_static(basename $0) } => 'bar'; | |
# Silence | |
app->log->level('warn'); | |
# Tests | |
my $t = Test::Mojo->new; | |
# Source code should be served from both URLs | |
$t->get_ok('/foo')->status_is(200)->content_like(qr|^#!/usr/bin/env perl|); | |
$t->get_ok('/bar')->status_is(200)->content_like(qr|^#!/usr/bin/env perl|); | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment