Created
February 2, 2012 13:08
-
-
Save memowe/1723381 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Test::More tests => 9; | |
use Test::Mojo; | |
use Mojolicious::Lite; | |
get '/:code' => [code => qr/\d\d\d/] => sub { | |
my $self = shift; | |
my $code = $self->param('code'); | |
$self->res->code($code); | |
$self->render(text => $code); | |
}; | |
my $t = Test::Mojo->new; | |
$t->get_ok('/200')->status_is(200)->content_is('200'); | |
$t->get_ok('/206')->status_is(206)->content_is('206'); | |
$t->get_ok('/207')->status_is(207)->content_is('207'); | |
__END__ | |
1..9 | |
ok 1 - get /200 | |
ok 2 - 200 OK | |
ok 3 - exact match for content | |
ok 4 - get /206 | |
ok 5 - 206 Partial Content | |
ok 6 - exact match for content | |
# Bad response start line. | |
not ok 7 - get /207 | |
# Failed test 'get /207' | |
# at olav.t line 18. | |
not ok 8 - 207 Multi-Status | |
# Failed test '207 Multi-Status' | |
# at olav.t line 18. | |
# got: undef | |
# expected: '207' | |
ok 9 - exact match for content | |
# Looks like you failed 2 tests of 9. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment