Make test skips actually work, fixes RT#47037
[catagits/Test-WWW-Mechanize-Catalyst.git] / t / cookies.t
index 823adb6..3017d36 100644 (file)
@@ -4,20 +4,23 @@ use warnings;
 use lib 'lib';
 use Test::More;
 
-eval {
-    require Catalyst::Plugin::Session;
-    require Catalyst::Plugin::Session::State::Cookie;
-};
+BEGIN {
+    eval {
+        require Catalyst::Plugin::Session;
+        require Catalyst::Plugin::Session::State::Cookie;
+    };
 
-if ($@) {
-    diag($@);
-    plan skip_all => "Need Catalyst::Plugin::Session to run this test";
-} else {
-    plan tests => 3;
+    if ($@) {
+        diag($@);
+        plan skip_all => "Need Catalyst::Plugin::Session to run this test";
+        exit 0;
+    }
 }
 use lib 't/lib';
 use Test::WWW::Mechanize::Catalyst 'CattySession';
 
+plan tests => 3;
+
 my $m = Test::WWW::Mechanize::Catalyst->new;
 $m->credentials( 'user', 'pass' );