From: diegok Date: Sun, 29 Dec 2013 12:13:45 +0000 (+0100) Subject: Better error report and small test refactor X-Git-Tag: v0.05^0 X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fwww-eztv.git;a=commitdiff_plain;h=70fdbac1e0fae8b661eaf75867fd9f436ba0547f Better error report and small test refactor --- diff --git a/Changes b/Changes index 5f7b35a..68d3ec0 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ {{$NEXT}} + - Force upgrade of Mojolicious to 4.X (no auto version from UA) + - Small error and tests refactor + +0.04 2013-12-25 23:15:03 Europe/Madrid + - Code updated for Mojo:UserAgent 4.X 0.03 2012-12-26 00:47:20 Europe/Madrid diff --git a/dist.ini b/dist.ini index 7ea623f..954ea8f 100644 --- a/dist.ini +++ b/dist.ini @@ -7,6 +7,9 @@ copyright_year = 2012 [@Basic] [@Git] +[Prereqs] +Mojolicious = 4.63 + [AutoPrereqs] [Git::NextVersion] @@ -29,13 +32,5 @@ repository.type = git user = diegok issues = 1 -;[ReadmeAnyFromPod] -; Default is plaintext README in build dir - -;[ReadmeAnyFromPod / ReadmePodInRoot] -;type = pod -;filename = README.pod -;location = root - [Prereqs / TestRequires] Test::More = 0.96 diff --git a/lib/WWW/EZTV/UA.pm b/lib/WWW/EZTV/UA.pm index 41df609..1b80ffc 100644 --- a/lib/WWW/EZTV/UA.pm +++ b/lib/WWW/EZTV/UA.pm @@ -18,7 +18,7 @@ sub get_response { else { my ($err, $code) = $tx->error; my $message = shift || 'User agent error'; - die "$message: $err ($code)"; + confess sprintf('%s: %s (%s)', $message, $err, $code||'no error code'); } } diff --git a/t/01-series.t b/t/01-series.t index 25d130d..f9354fd 100755 --- a/t/01-series.t +++ b/t/01-series.t @@ -6,8 +6,12 @@ use Test::More; BEGIN { use_ok( 'WWW::EZTV' ); } ok( my $eztv = WWW::EZTV->new, 'Build eztv crawler' ); -isa_ok( $eztv->shows, 'Mojo::Collection' ); -isa_ok( $eztv->shows->[0], 'WWW::EZTV::Show' ); + +subtest 'Can retrieve shows' => sub { + ok( $eztv->has_shows, 'Can fetch shows list' ); + isa_ok( $eztv->shows, 'Mojo::Collection' ); + isa_ok( $eztv->shows->[0], 'WWW::EZTV::Show' ); +}; subtest 'All shows has name and URL' => sub { my $has_year = 0;