Skip to content

Instantly share code, notes, and snippets.

/test.pl Secret

Created December 26, 2016 04:20
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 anonymous/b2793006b202700ef83cee870d766237 to your computer and use it in GitHub Desktop.
Save anonymous/b2793006b202700ef83cee870d766237 to your computer and use it in GitHub Desktop.
{
package Site;
use Mojo::Base 'Mojolicious';
use strict;
use warnings;
our $VERSION = "0.01";
sub startup {
my $self = shift;
$self->sessions->cookie_name(__PACKAGE__);
$self->sessions->default_expiration(24 * 60 * 60 * 365); #1 year
my $r = $self->routes;
$r->namespaces(['Site::Controller']);
my $home = $r->any('/')->to(controller => 'Home');
$home->get('/')->to(action => 'get');
$self->log->path('mojo.log');
$self->log->level('debug');
}
1;
}
{
package Site::Controller::Home;
use base qw|Mojolicious::Controller|;
sub get {
my $self = shift;
warn "UNDER GET";
$self->app->log->warn('log is here');
$self->render( text => 'LALALA' );
}
1;
}
{
use Test::More;
use Test::Mojo;
my $t = Test::Mojo->new('Site');
$t->get_ok('/')->status_is(200);
done_testing;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment