Skip to content

Instantly share code, notes, and snippets.

@memowe
Created August 17, 2010 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save memowe/528182 to your computer and use it in GitHub Desktop.
Save memowe/528182 to your computer and use it in GitHub Desktop.
#!/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