diff options
Diffstat (limited to 't/spore-request')
-rw-r--r-- | t/spore-request/exception.t | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/t/spore-request/exception.t b/t/spore-request/exception.t index fdf51cb..1173e84 100644 --- a/t/spore-request/exception.t +++ b/t/spore-request/exception.t @@ -1,6 +1,7 @@ use strict; use warnings; +use Try::Tiny; use Test::More; use Net::HTTP::Spore; @@ -13,12 +14,20 @@ my $mock_server = { ok my $client = Net::HTTP::Spore->new_from_spec( 't/specs/api.json', - base_url => 'http://localhost' ); + base_url => 'http://localhost' ), "client created"; $client->enable( 'Mock', tests => $mock_server ); -my $res = $client->get_info(); -is $res->[0], 599; -like $res->[2]->{error}, qr/Died/; +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; |