Browse files

added build_controller example to Test::Mojo

  • Loading branch information...
1 parent 66a5661 commit 0794b382693f23dfd24771a38ddfd9e5ee6e9e35 @kraih committed Mar 9, 2014
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/Test/Mojo.pm
View
4 lib/Test/Mojo.pm
@@ -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 {

0 comments on commit 0794b38

Please sign in to comment.