Skip to content

Commit

Permalink
added build_controller example to Test::Mojo
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 9, 2014
1 parent 66a5661 commit 0794b38
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Test/Mojo.pm
Expand Up @@ -488,6 +488,10 @@ Access application with L<Mojo::UserAgent/"app">.
# Test application directly
is $t->app->defaults->{foo}, 'bar', 'right value';
ok $t->app->routes->find('echo')->is_websocket, 'WebSocket route';
my $c = $t->app->build_controller;
ok $c->render(template => 'foo'), 'rendering was successful';
is $c->res->status, 200, 'right status';
is $c->res->body, 'Foo!', 'right content';
# Change application behavior
$t->app->hook(before_dispatch => sub {
Expand Down

0 comments on commit 0794b38

Please sign in to comment.