Fix infinite redirects. RT#76614
[catagits/Test-WWW-Mechanize-Catalyst.git] / t / multi_content_type.t
index 4fb0a25..7cd92d3 100644 (file)
@@ -7,7 +7,6 @@ my $PORT;
 
 BEGIN {
     $PORT = $ENV{TWMC_TEST_PORT} || 7357;
-    $ENV{CATALYST_SERVER} ||= "http://localhost:$PORT";
 }
 
 use Test::More tests => 9;
@@ -27,7 +26,9 @@ BEGIN {
 $SIG{INT} = sub { warn "INT:$$"; exit };
 
 use_ok 'ExternalCatty';
-my $pid = ExternalCatty->background($PORT);
+my $pid;
+($pid, $PORT) = ExternalCatty->background($PORT);
+$ENV{CATALYST_SERVER} ||= "http://localhost:$PORT";
 
 use Test::WWW::Mechanize::Catalyst;
 my $m = Test::WWW::Mechanize::Catalyst->new;
@@ -38,11 +39,12 @@ TRY_CONNECT: {
 
   if ($@ || $m->content =~ /Can't connect to \w+:$PORT/) {
     $skip = $@ || $m->content;
+    diag $m;
   }
 }
 
 SKIP: {
-  skip $skip, 8 if $skip;
+  skip $skip, 9 if $skip;
   lives_ok { $m->get_ok( '/', 'Get a multi Content-Type response' ) }
   'Survive to a multi Content-Type sting';