blob: 1173e84739948da1ff3e3a0bc01f8d373f918c99 (
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
25
26
27
28
29
30
31
32
33
|
use strict;
use warnings;
use Try::Tiny;
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 created";
$client->enable( 'Mock', tests => $mock_server );
my $res;
try {
$res = $client->get_info();
}
catch {
$res = $_;
like $res, qr/status: 599/, "stringify ok";
is $res->[0], 599, "status ok (as arrayref)";
like $res->[2]->{error}, qr/Died/, "body ok (as arrayref)";
};
done_testing;
|