From: Ash Berlin Date: Thu, 12 Feb 2009 09:49:45 +0000 (+0000) Subject: Make t/multi_content_type.t handle case when server cant be started, which is almost... X-Git-Tag: 0.51~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FTest-WWW-Mechanize-Catalyst.git;a=commitdiff_plain;h=cfd812d6df038fa098c69af4e8a80e0342e7b1ce Make t/multi_content_type.t handle case when server cant be started, which is almost always due to port in use. --- diff --git a/CHANGES b/CHANGES index 5be7a7b..5cecf9b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ Revision history for Perl module Test::WWW::Mechanize::Catalyst: +0.50_2 Thur Feb 12 09:47 GMT 2008 + - Make t/multi_content_type.t handle case when server cant be started, + which is almost always due to port in use. + 0.50_1 Thur Feb 5 09:02 GMT 2008 - App classname no longer has to be passed to import: $m = T::W::M::C->new(catalyst_app => 'Catty') diff --git a/Makefile.PL b/Makefile.PL index 3e50e0a..83e80c7 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,5 +1,5 @@ #!perl -use inc::Module::Install 0.77; +use inc::Module::Install 0.79; use strict; use warnings; diff --git a/lib/Test/WWW/Mechanize/Catalyst.pm b/lib/Test/WWW/Mechanize/Catalyst.pm index 45bc029..4248f49 100644 --- a/lib/Test/WWW/Mechanize/Catalyst.pm +++ b/lib/Test/WWW/Mechanize/Catalyst.pm @@ -12,7 +12,7 @@ extends 'Test::WWW::Mechanize', 'Moose::Object'; use namespace::clean -execept => 'meta'; -our $VERSION = '0.50_1'; +our $VERSION = '0.50_2'; our $APP_CLASS; my $Test = Test::Builder->new(); diff --git a/t/multi_content_type.t b/t/multi_content_type.t index 6fbdaa4..081a47e 100644 --- a/t/multi_content_type.t +++ b/t/multi_content_type.t @@ -32,15 +32,27 @@ my $pid = ExternalCatty->background($PORT); use Test::WWW::Mechanize::Catalyst; my $m = Test::WWW::Mechanize::Catalyst->new; -lives_ok { $m->get_ok( '/', 'Get a multi Content-Type response' ) } -'Survive to a multi Content-Type sting'; +my $skip = 0; +TRY_CONNECT: { + eval { $m->get('/') }; -is( $m->ct, 'text/html', 'Multi Content-Type Content-Type' ); -$m->title_is( 'Root', 'Multi Content-Type title' ); -$m->content_contains( "Hello, test \x{263A}!", 'Multi Content-Type body' ); + if ($@ || $m->content =~ /\(connect: Connection refused\)/) { + $skip = $@ || $m->content; + } +} + +SKIP: { + skip $skip, 5 if $skip; + lives_ok { $m->get_ok( '/', 'Get a multi Content-Type response' ) } + 'Survive to a multi Content-Type sting'; + + is( $m->ct, 'text/html', 'Multi Content-Type Content-Type' ); + $m->title_is( 'Root', 'Multi Content-Type title' ); + $m->content_contains( "Hello, test \x{263A}!", 'Multi Content-Type body' ); +} END { - if ( $pid > 0 ) { + if ( $pid && $pid > 0 ) { kill 9, $pid; } }