generate app for live tests manually rather than using Catalyst::Devel
[catagits/Catalyst-Runtime.git] / xt / author / http-server.t
index 8667cad..ffd95c0 100644 (file)
@@ -9,34 +9,13 @@ use FindBin;
 use Net::EmptyPort qw(wait_port empty_port);
 use Try::Tiny;
 use Plack::Builder;
-
-eval { require Catalyst::Devel; Catalyst::Devel->VERSION(1.0); 1; } || do {
-    fail("Could not load Catalyst::Devel: $@");
-    exit 1;
-};
-
-eval { require File::Copy::Recursive; 1 } || do {
-    fail("Could not load File::Copy::Recursive: $@");
-    exit 1;
-};
+use lib 't/lib';
+use MakeTestApp;
 
 # Run a single test by providing it as the first arg
 my $single_test = shift;
 
-my $tmpdir = "$FindBin::Bin/../../t/tmp";
-
-# clean up
-rmtree $tmpdir if -d $tmpdir;
-
-# create a TestApp and copy the test libs into it
-mkdir $tmpdir;
-chdir $tmpdir;
-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' ) or die;
-
-# remove TestApp's tests
-rmtree '../t/tmp/TestApp/t' or die;
+my $test_app_dir = make_test_app;
 
 # spawn the standalone HTTP server
 my $port = empty_port;
@@ -48,7 +27,7 @@ if ($pid) {
     wait_port_timeout($port, 30);
 } elsif ($pid == 0) {
     # child process
-    unshift @INC, "$tmpdir/TestApp/lib", "$FindBin::Bin/../../lib";
+    unshift @INC, "$test_app_dir/lib", "$FindBin::Bin/../../lib";
     require TestApp;
 
     my $psgi_app = TestApp->apply_default_middlewares(TestApp->psgi_app);