switch from eval/require to Test::Needs
Karen Etheridge [Tue, 27 Jun 2017 21:37:05 +0000 (14:37 -0700)]
dist.ini
t/live_app.t
t/live_app_digest.t
t/live_app_digest_dotnet.t

index 8780532..575aa81 100644 (file)
--- a/dist.ini
+++ b/dist.ini
@@ -25,6 +25,8 @@ Catalyst::Plugin::Authentication = 0.10005
 
 [Prereqs / DevelopRequires]
 Test::WWW::Mechanize::Catalyst = 0.51
+Catalyst::Plugin::Cache = 0
+Cache::FileCache = 0
 
 [MetaResources]
 x_IRC = irc://irc.perl.org/#catalyst
index ea3e5c6..95ae56b 100644 (file)
@@ -5,15 +5,7 @@ use FindBin qw/$Bin/;
 use lib "$Bin/lib";
 
 use Test::More;
-BEGIN {
-    do {
-        eval { require Test::WWW::Mechanize::Catalyst }
-        and
-        Test::WWW::Mechanize::Catalyst->VERSION('0.51')
-    }
-      or plan skip_all =>
-      "Test::WWW::Mechanize::Catalyst is needed for this test";
-}
+use Test::Needs { 'Test::WWW::Mechanize::Catalyst' => '0.51' };
 use HTTP::Request;
 
 use Test::More;
index 1a96d15..56894a4 100644 (file)
@@ -3,22 +3,14 @@ use warnings;
 use FindBin qw/$Bin/;
 use lib "$Bin/lib";
 use Test::More;
-BEGIN {
-    do {
-        eval { require Test::WWW::Mechanize::Catalyst }
-        and
-        Test::WWW::Mechanize::Catalyst->VERSION('0.51')
-    }
-      or plan skip_all =>
-      "Test::WWW::Mechanize::Catalyst is needed for this test";
-    eval { require Catalyst::Plugin::Cache }
-      or plan skip_all =>
-      "Catalyst::Plugin::Cache is needed for this test";
-    eval { require Cache::FileCache }
-      or plan skip_all =>
-      "Cache::FileCache is needed for this test";
-    plan tests => 12;
-}
+use Test::Needs {
+    'Test::WWW::Mechanize::Catalyst' => '0.51',
+    'Catalyst::Plugin::Cache' => '0',
+    'Cache::FileCache' => undef,
+};
+
+plan tests => 12;
+
 use Digest::MD5;
 use HTTP::Request;
 use Test::More;
index 415b148..6149d93 100644 (file)
@@ -3,22 +3,14 @@ use warnings;
 use FindBin qw/$Bin/;
 use lib "$Bin/lib";
 use Test::More;
-BEGIN {
-    do {
-        eval { require Test::WWW::Mechanize::Catalyst }
-        and
-        Test::WWW::Mechanize::Catalyst->VERSION('0.51')
-    }
-      or plan skip_all =>
-      "Test::WWW::Mechanize::Catalyst is needed for this test";
-    eval { require Catalyst::Plugin::Cache }
-      or plan skip_all =>
-      "Catalyst::Plugin::Cache is needed for this test";
-    eval { require Cache::FileCache }
-      or plan skip_all =>
-      "Cache::FileCache is needed for this test";
-    plan tests => 19;
-}
+use Test::Needs {
+    'Test::WWW::Mechanize::Catalyst' => '0.51',
+    'Catalyst::Plugin::Cache' => '0',
+    'Cache::FileCache' => undef,
+};
+
+plan tests => 19;
+
 use Digest::MD5;
 use HTTP::Request;
 use Test::More;