Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
a few more get command tests
  • Loading branch information
kraih committed Jan 16, 2015
1 parent 7699e31 commit 7b03bcb
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions t/mojolicious/commands.t
Expand Up @@ -186,6 +186,29 @@ $buffer = '';
$get->run('/');
}
like $buffer, qr/Your Mojo is working!/, 'right output';
$get->app->hook(
before_dispatch => sub {
my $c = shift;
return $c->render(text => '<p>works</p>')
if $c->req->url->path->contains('/html');
$c->render(json => {works => 'too'})
if $c->req->url->path->contains('/json');
}
);
$buffer = '';
{
open my $handle, '>', \$buffer;
local *STDOUT = $handle;
$get->run('/html', 'p', 'text');
}
like $buffer, qr/works/, 'right output';
$buffer = '';
{
open my $handle, '>', \$buffer;
local *STDOUT = $handle;
$get->run('/json', '/works');
}
like $buffer, qr/too/, 'right output';

# inflate
require Mojolicious::Command::inflate;
Expand Down

0 comments on commit 7b03bcb

Please sign in to comment.