update cookie BEFORE sending to user; change finalize to finalize_headers so that...
[catagits/Catalyst-Plugin-Session.git] / t / 06_finalize.t
index b668f77..b1aac67 100644 (file)
@@ -3,12 +3,22 @@
 use strict;
 use warnings;
 
-use Test::More tests => 2;
+use Test::More;
+
+BEGIN {
+    if ( eval { require Catalyst::Plugin::Session::State::Cookie } ) {
+        plan tests => 3;
+    } else {
+        plan skip_all => "Catalyst::Plugin::Session::State::Cookie required";
+    }
+}
+
+my $finalized = 0;
 
 {
   package TestPlugin;
+  BEGIN { $INC{"TestPlugin.pm"} = 1 } # nasty hack for 5.8.6
 
-  my $finalized = 0;
   sub finalize_session { $finalized = 1 }
 
   sub finalize { die "already finalized_session()" if $finalized }
@@ -28,3 +38,4 @@ BEGIN { use_ok('Catalyst::Plugin::Session') }
 my $c = TestApp->new;
 eval { $c->finalize };
 ok(!$@, "finalize_session() called after all other finalize() methods");
+ok($finalized, "finalize_session() called");