From 70fdbac1e0fae8b661eaf75867fd9f436ba0547f Mon Sep 17 00:00:00 2001 From: diegok Date: Sun, 29 Dec 2013 13:13:45 +0100 Subject: [PATCH] Better error report and small test refactor --- Changes | 5 +++++ dist.ini | 11 +++-------- lib/WWW/EZTV/UA.pm | 2 +- t/01-series.t | 8 ++++++-- 4 files changed, 15 insertions(+), 11 deletions(-) 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; -- 2.20.1