generate app for live tests manually rather than using Catalyst::Devel
[catagits/Catalyst-Runtime.git] / t / optional_lighttpd-fastcgi.t
index 9e4daf1..1d3ca40 100644 (file)
@@ -12,17 +12,19 @@ use FindBin;
 use IO::Socket;
 use Config ();
 
-eval "use FCGI";
-plan skip_all => 'FCGI required' if $@;
+BEGIN {
+    eval "use FCGI";
+    plan skip_all => 'FCGI required' if $@;
 
-eval "use Catalyst::Devel 1.0";
-plan skip_all => 'Catalyst::Devel required' if $@;
+    eval "use File::Copy::Recursive";
+    plan skip_all => 'File::Copy::Recursive required' if $@;
 
-eval "use File::Copy::Recursive";
-plan skip_all => 'File::Copy::Recursive required' if $@;
+    eval "use Test::Harness";
+    plan skip_all => 'Test::Harness required' if $@;
+}
 
-eval "use Test::Harness";
-plan skip_all => 'Test::Harness required' if $@;
+use lib 't/lib';
+use MakeTestApp;
 
 my $lighttpd_bin = $ENV{LIGHTTPD_BIN} || `which lighttpd`;
 chomp $lighttpd_bin;
@@ -32,18 +34,8 @@ plan skip_all => 'Please set LIGHTTPD_BIN to the path to lighttpd'
 
 plan tests => 1;
 
-# clean up
-rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
-
-# create a TestApp and copy the test libs into it
-mkdir "$FindBin::Bin/../t/tmp";
-chdir "$FindBin::Bin/../t/tmp";
-system "$^X -I$FindBin::Bin/../lib $FindBin::Bin/../script/catalyst.pl TestApp";
-chdir "$FindBin::Bin/..";
-File::Copy::Recursive::dircopy( 't/lib', 't/tmp/TestApp/lib' );
-
-# remove TestApp's tests
-rmtree 't/tmp/TestApp/t';
+# this creates t/tmp/TestApp
+make_test_app;
 
 # Create a temporary lighttpd config
 my $docroot = "$FindBin::Bin/../t/tmp";