Skip to content

Commit

Permalink
added custom test example
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 3, 2014
1 parent 2782efc commit 4e21bba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/Test/Mojo.pm
Expand Up @@ -416,6 +416,18 @@ Current WebSocket message.
True if the last test was successful.
# Build custom tests
my $location_is = sub {
my ($t, $value, $desc) = @_;
$desc ||= "Location: $value";
local $Test::Builder::Level = $Test::Builder::Level + 1;
return $t->success(is($location, $t->tx->res->headers->location, $desc));
};
$t->get_ok('/')
->status_is(302)
->$location_is('http://mojolicio.us')
->or(sub { note shift->tx->res->headers->location });
=head2 tx
my $tx = $t->tx;
Expand Down

0 comments on commit 4e21bba

Please sign in to comment.