From: Tomas Doran Date: Mon, 8 Mar 2010 01:19:03 +0000 (+0000) Subject: Make test skips actually work, fixes RT#47037 X-Git-Tag: 0.52~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FTest-WWW-Mechanize-Catalyst.git;a=commitdiff_plain;h=689c5a5d7e82d1a2b014066ca31561cff32e83b0 Make test skips actually work, fixes RT#47037 --- diff --git a/t/cookies.t b/t/cookies.t index 823adb6..3017d36 100644 --- a/t/cookies.t +++ b/t/cookies.t @@ -4,20 +4,23 @@ use warnings; use lib 'lib'; use Test::More; -eval { - require Catalyst::Plugin::Session; - require Catalyst::Plugin::Session::State::Cookie; -}; +BEGIN { + eval { + require Catalyst::Plugin::Session; + require Catalyst::Plugin::Session::State::Cookie; + }; -if ($@) { - diag($@); - plan skip_all => "Need Catalyst::Plugin::Session to run this test"; -} else { - plan tests => 3; + if ($@) { + diag($@); + plan skip_all => "Need Catalyst::Plugin::Session to run this test"; + exit 0; + } } use lib 't/lib'; use Test::WWW::Mechanize::Catalyst 'CattySession'; +plan tests => 3; + my $m = Test::WWW::Mechanize::Catalyst->new; $m->credentials( 'user', 'pass' ); diff --git a/t/two_app.t b/t/two_app.t index a54529b..edbcc27 100644 --- a/t/two_app.t +++ b/t/two_app.t @@ -4,20 +4,23 @@ use warnings; use Test::More; use lib 't/lib'; -eval { - require Catalyst::Plugin::Session; - require Catalyst::Plugin::Session::State::Cookie; -}; - -if ($@) { - diag($@); - plan skip_all => "Need Catalyst::Plugin::Session to run this test"; -} else { - plan tests => 4; +BEGIN { + eval { + require Catalyst::Plugin::Session; + require Catalyst::Plugin::Session::State::Cookie; + }; + + if ($@) { + diag($@); + plan skip_all => "Need Catalyst::Plugin::Session to run this test"; + exit 0; + } } use Test::WWW::Mechanize::Catalyst; +plan tests => 4; + my $m1 = Test::WWW::Mechanize::Catalyst->new(catalyst_app => 'Catty'); my $m2 = Test::WWW::Mechanize::Catalyst->new(catalyst_app => 'CattySession');