Better error report and small test refactor v0.05
authordiegok <diego@freekeylabs.com>
Sun, 29 Dec 2013 12:13:45 +0000 (13:13 +0100)
committerdiegok <diego@freekeylabs.com>
Sun, 29 Dec 2013 12:13:45 +0000 (13:13 +0100)
Changes
dist.ini
lib/WWW/EZTV/UA.pm
t/01-series.t

diff --git a/Changes b/Changes
index 5f7b35a..68d3ec0 100644 (file)
--- 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
index 7ea623f..954ea8f 100644 (file)
--- 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
index 41df609..1b80ffc 100644 (file)
@@ -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');
     }
 }
 
index 25d130d..f9354fd 100755 (executable)
@@ -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;