Merge branch 'master' into psgi
[catagits/Catalyst-Devel.git] / share / t / comptest.tt
index dd2c5e6..9ac67d6 100644 (file)
@@ -1,23 +1,26 @@
 use strict;
 use warnings;
-[% IF long_type == 'Controller' %][% IF mech %]use Test::More;
+use Test::More;
+[% IF long_type == 'Controller' %][% IF mech %]
 
-eval "use Test::WWW::Mechanize::Catalyst '[% app %]'";
-plan $@
-    ? ( skip_all => 'Test::WWW::Mechanize::Catalyst required' )
-    : ( tests => 2 );
+unless (eval q{use Test::WWW::Mechanize::Catalyst '[% name %]'; 1}) {
+    plan skip_all => 'Test::WWW::Mechanize::Catalyst required';
+    exit 0;
+}
 
 ok( my $mech = Test::WWW::Mechanize::Catalyst->new, 'Created mech object' );
 
 $mech->get_ok( 'http://localhost[% uri %]' );
-[% ELSE %]use Test::More tests => 3;
+[%- ELSE %]
 
-BEGIN { use_ok 'Catalyst::Test', '[% app %]' }
-BEGIN { use_ok '[% class %]' }
+use Catalyst::Test '[% app %]';
+use [% class %];
 
 ok( request('[% uri %]')->is_success, 'Request should succeed' );
-[% END %]
-[% ELSE %]use Test::More tests => 1;
+[%- END -%]
+[% ELSE %]
 
 BEGIN { use_ok '[% class %]' }
-[% END %]
+[% END -%]
+
+done_testing();