[Catalyst-commits] r12052 - Catalyst-Devel/1.00/branches/helper_refactor/t

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Fri Nov 27 01:44:44 GMT 2009


Author: t0m
Date: 2009-11-27 01:44:43 +0000 (Fri, 27 Nov 2009)
New Revision: 12052

Modified:
   Catalyst-Devel/1.00/branches/helper_refactor/t/back_compat.t
   Catalyst-Devel/1.00/branches/helper_refactor/t/generated_app.t
   Catalyst-Devel/1.00/branches/helper_refactor/t/get_sharedir_file.t
   Catalyst-Devel/1.00/branches/helper_refactor/t/render_file_contents.t
   Catalyst-Devel/1.00/branches/helper_refactor/t/render_share_dir_file.t
Log:
Fix up all test tests

Modified: Catalyst-Devel/1.00/branches/helper_refactor/t/back_compat.t
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/t/back_compat.t	2009-11-27 01:18:47 UTC (rev 12051)
+++ Catalyst-Devel/1.00/branches/helper_refactor/t/back_compat.t	2009-11-27 01:44:43 UTC (rev 12052)
@@ -3,11 +3,10 @@
 use FindBin qw/$Bin/;
 use File::Temp qw/tempfile/;
 use lib "$Bin/lib";
-use Data::Dumper;
 
 use MyTestHelper;
 
-use Test::More tests => 3;
+use Test::More;
 
 my $helper = bless {}, 'MyTestHelper';
 
@@ -38,3 +37,4 @@
 }
 is $contents, "foobartest_val\n";
 
+done_testing;

Modified: Catalyst-Devel/1.00/branches/helper_refactor/t/generated_app.t
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/t/generated_app.t	2009-11-27 01:18:47 UTC (rev 12051)
+++ Catalyst-Devel/1.00/branches/helper_refactor/t/generated_app.t	2009-11-27 01:44:43 UTC (rev 12052)
@@ -1,12 +1,11 @@
 use strict;
 use warnings;
-
+use lib ();
 use File::Temp qw/ tempdir tmpnam /;
 use File::Spec;
-use Test::WWW::Mechanize;
 use Catalyst::Devel;
 
-my $dir = tempdir();
+my $dir = tempdir(CLEANUP => 1);
 my $devnull = File::Spec->devnull;
 
 use Test::More;
@@ -23,9 +22,10 @@
     }
     is $exit, 0, 'Exit status ok';
 }
-# FIXME paths / nl work on win32
-chdir("$dir/TestApp/");
 
+chdir(File::Spec->catdir($dir, 'TestApp'));
+lib->import(File::Spec->catdir($dir, 'TestApp', 'lib'));
+
 my @files = qw|
     Makefile.PL
     testapp.conf
@@ -70,7 +70,7 @@
 
 {
     local $ENV{TEST_POD} = 1;
-
+    local $ENV{CATALYST_DEBUG} = 0;
     foreach my $test (grep { m|^t/| } @files) {
         subtest "Generated app test: $test", sub {
             require $test;
@@ -78,24 +78,6 @@
     }
 }
 
-## Moosey server tests - kmx++
-my $server_path   = File::Spec->catfile('script', 'testapp_server.pl');
-my $port = int(rand(10000)) + 40000; # get random port between 40000-50000
-
-my $childpid = fork();
-die "fork() error, cannot continue" unless defined($childpid);
-
-if ($childpid == 0) {
-  system("$^X $server_path -p $port > $devnull 2>&1");
-  exit; # just for sure; we should never got here
-}
-
-sleep 10; #wait for catalyst application to start
-my $mech = Test::WWW::Mechanize->new;
-$mech->get_ok( "http://localhost:" . $port );
-
-kill 'KILL', $childpid;
-
 my $server_script = do {
     open(my $fh, '<', 'script/testapp_server.pl') or die $!;
     local $/;
@@ -107,6 +89,4 @@
 is $1, $Catalyst::Devel::CATALYST_SCRIPT_GEN, 'Script gen correct';
 
 chdir('/');
-
 done_testing;
-

Modified: Catalyst-Devel/1.00/branches/helper_refactor/t/get_sharedir_file.t
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/t/get_sharedir_file.t	2009-11-27 01:18:47 UTC (rev 12051)
+++ Catalyst-Devel/1.00/branches/helper_refactor/t/get_sharedir_file.t	2009-11-27 01:44:43 UTC (rev 12052)
@@ -1,13 +1,12 @@
 use strict;
 use warnings;
 
-use Test::MockObject::Extends;
-use Test::More tests => 3;
+use Test::More;
 use Test::Exception;
 
 use Catalyst::Helper;
 
-my $i = Test::MockObject::Extends->new('Catalyst::Helper');
+my $i = bless {}, 'Catalyst::Helper';
 
 throws_ok {
     $i->get_sharedir_file(qw/does not exist and hopefully never will or we are
@@ -18,3 +17,4 @@
     ok($i->get_sharedir_file('Makefile.PL.tt'), 'has contents');
 } 'Can get_sharedir_file';
 
+done_testing;

Modified: Catalyst-Devel/1.00/branches/helper_refactor/t/render_file_contents.t
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/t/render_file_contents.t	2009-11-27 01:18:47 UTC (rev 12051)
+++ Catalyst-Devel/1.00/branches/helper_refactor/t/render_file_contents.t	2009-11-27 01:44:43 UTC (rev 12052)
@@ -3,17 +3,18 @@
 use FindBin qw/$Bin/;
 use lib "$Bin/lib";
 use Catalyst::Helper;
-use MyTestHelper;
 
-use Test::More tests => 1;
+use Test::More;
 
-my $helper = bless {}, 'MyTestHelper';
+my $helper = bless {}, 'Catalyst::Helper';
 
-package MyTestHelper;
-use Test::More;
 use File::Temp qw/tempfile/;
 
 my ($fh, $fn) = tempfile;
 close $fh;
 
 ok( $helper->render_file_contents('example1',  $fn, { test_var => 'test_val' }), "file contents rendered" ); 
+ok -r $fn;
+unlink $fn;
+
+done_testing;

Modified: Catalyst-Devel/1.00/branches/helper_refactor/t/render_share_dir_file.t
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/t/render_share_dir_file.t	2009-11-27 01:18:47 UTC (rev 12051)
+++ Catalyst-Devel/1.00/branches/helper_refactor/t/render_share_dir_file.t	2009-11-27 01:44:43 UTC (rev 12052)
@@ -3,18 +3,17 @@
 use FindBin qw/$Bin/;
 use lib "$Bin/lib";
 use Catalyst::Helper;
-use MyTestHelper;
+use Test::More;
 
-use Test::More tests => 1;
+my $helper = bless {}, 'Catalyst::Helper';
 
-my $helper = bless {}, 'MyTestHelper';
-
-package MyTestHelper;
-use FindBin qw/$Bin/;
-use Test::More;
 use File::Temp qw/tempfile/;
 
 my ($fh, $fn) = tempfile;
 close $fh;
 
-ok( $helper->render_sharedir_file('script/myapp_cgi.pl.tt',  { appprefix  => 'fnargh' }), "sharedir file rendered" ); 
+ok( $helper->render_sharedir_file('script/myapp_cgi.pl.tt', $fn, { appprefix  => 'fnargh' }), "sharedir file rendered" ); 
+ok -r $fn;
+unlink $fn;
+
+done_testing;




More information about the Catalyst-commits mailing list