summary refs log tree commit diff
path: root/t/spore-request/exception.t
blob: fdf51cbab93b2530ef2ebeeeea60509efcf7e23d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use warnings;

use Test::More;
use Net::HTTP::Spore;

my $mock_server = {
    '/show' => sub {
        my $req = shift;
        die;
    },
};

ok my $client =
  Net::HTTP::Spore->new_from_spec( 't/specs/api.json',
    base_url => 'http://localhost' );

$client->enable( 'Mock', tests => $mock_server );

my $res = $client->get_info();
is $res->[0], 599;
like $res->[2]->{error}, qr/Died/;

done_testing;