X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xt%2Fauthor%2Fhttp-server.t;h=ffd95c0c3fbc553727d460ac0fd258b34943834d;hb=964bf130533c001789a80ef193f03d5c5f3817eb;hp=8667cada055f1a167d5e6b2add9cc4a60b5d3e35;hpb=a1e953c8b8e91f1195881f13e0fa21528afd34de;p=catagits%2FCatalyst-Runtime.git diff --git a/xt/author/http-server.t b/xt/author/http-server.t index 8667cad..ffd95c0 100644 --- a/xt/author/http-server.t +++ b/xt/author/http-server.t @@ -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);