Skip to content

Commit

Permalink
added test for custom Mojolicious::Lite keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 20, 2012
1 parent 7af5a5a commit 5029e41
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions t/mojolicious/layouted_lite_app.t
Expand Up @@ -12,6 +12,7 @@ use FindBin;
use lib "$FindBin::Bin/lib";

use Mojolicious::Lite;
use LiteTestKeyword;
use Test::Mojo;

# Plugin with a template
Expand All @@ -22,8 +23,8 @@ app->renderer->paths->[0] = app->home->rel_dir('does_not_exist');
# Default layout for whole application
app->defaults(layout => 'default');

# GET /works
get '/works';
# GET /works (custom keyword)
test_keyword '/works';

# GET /doenotexist
get '/doesnotexist';
Expand Down
11 changes: 11 additions & 0 deletions t/mojolicious/lib/LiteTestKeyword.pm
@@ -0,0 +1,11 @@
package LiteTestKeyword;
use Mojo::Base -base;

use Mojo::Util 'monkey_patch';

sub import {
my $caller = caller;
monkey_patch $caller, 'test_keyword', sub { $caller->app->routes->get(@_) };
}

1;

0 comments on commit 5029e41

Please sign in to comment.