100% Coverage in BeastBB::Response.
This commit is contained in:
parent
9f347030e3
commit
9913b7e421
|
@ -1,6 +1,6 @@
|
||||||
use 5.32.1;
|
use 5.32.1;
|
||||||
|
|
||||||
use Test::Most tests => 4;
|
use Test::Most tests => 7;
|
||||||
use Test::Warnings ':all';
|
use Test::Warnings ':all';
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
@ -34,3 +34,29 @@ use warnings;
|
||||||
'BeastBB::Response warns on construction if is_error is true and error message is not passed.'
|
'BeastBB::Response warns on construction if is_error is true and error message is not passed.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
my $response =
|
||||||
|
BeastBB::Response->new( is_error => 1, error_message => 'example error' );
|
||||||
|
throws_ok {
|
||||||
|
$response->Content;
|
||||||
|
}
|
||||||
|
qr/Attempt to get content from error\./,
|
||||||
|
'BeastBB::Response dies trying to recover content from error.';
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
my $response = BeastBB::Response->new( content => 'example_content' );
|
||||||
|
throws_ok {
|
||||||
|
$response->ErrorMessage;
|
||||||
|
}
|
||||||
|
qr/This is not an error\./,
|
||||||
|
'BeastBB::Response dies trying to recover error message if it is not an error.';
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
my $response =
|
||||||
|
BeastBB::Response->new( is_error => 1, error_message => 'example error' );
|
||||||
|
is $response->ErrorMessage, 'example error',
|
||||||
|
'ErrorMessage can be recovered from BeastBB::Response.';
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue