Skip to content

Commit

Permalink
more tests for Mojo::UserAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 18, 2014
1 parent 4154f72 commit 59e5287
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions t/mojo/user_agent.t
Expand Up @@ -46,6 +46,8 @@ post '/echo' => sub {
$self->render(data => $self->req->body);
};

any '/method' => {inline => '<%= $self->req->method =%>'};

# Max redirects
{
local $ENV{MOJO_MAX_REDIRECTS} = 25;
Expand Down Expand Up @@ -151,6 +153,15 @@ ok $tx->success, 'successful';
is $tx->res->code, 200, 'right status';
is $tx->res->body, 'works!', 'right content';

# Shortcuts for common request methods
is $ua->delete('/method')->res->body, 'DELETE', 'right content';
is $ua->get('/method')->res->body, 'GET', 'right content';
is $ua->head('/method')->res->body, '', 'no content';
is $ua->options('/method')->res->body, 'OPTIONS', 'right method';
is $ua->patch('/method')->res->body, 'PATCH', 'right method';
is $ua->post('/method')->res->body, 'POST', 'right method';
is $ua->put('/method')->res->body, 'PUT', 'right method';

# Events
my ($finished_req, $finished_tx, $finished_res);
$tx = $ua->build_tx(GET => '/');
Expand Down

0 comments on commit 59e5287

Please sign in to comment.