Fix RT#58856
Tomas Doran [Mon, 19 Jul 2010 19:21:29 +0000 (19:21 +0000)]
Changes
Makefile.PL
lib/Catalyst/Plugin/Session.pm
t/lib/SessionTestApp/Controller/Root.pm
t/live_app.t

diff --git a/Changes b/Changes
index 301c8b4..9f61165 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for Perl extension Catalyst::Plugin::Session
 
+        - Fix session being loaded by call to dump_these in debug mode
+          (RT#58856)
+
 0.30 2010-06-24
         - Fix Makefile.PL's is_upgrading_needed() routine (RT #58771)
 
index e9482f6..69bbbbf 100644 (file)
@@ -26,7 +26,7 @@ requires 'Moose' => '0.76';
 requires 'Tie::RefHash' => '1.34';
 
 # for Test::Store
-requires 'Test::More';
+requires 'Test::More' => '0.88';
 
 test_requires 'Test::Deep';
 test_requires 'Test::Exception';
index 89e39aa..3a28416 100644 (file)
@@ -578,7 +578,7 @@ sub dump_these {
     (
         $c->maybe::next::method(),
 
-        $c->sessionid
+        $c->_sessionid
         ? ( [ "Session ID" => $c->sessionid ], [ Session => $c->session ], )
         : ()
     );
index 36033be..ff80dd6 100644 (file)
@@ -88,4 +88,16 @@ sub accessor_test : Global {
     }
 }
 
+sub dump_these_loads_session : Global {
+    my ($self, $c) = @_;
+
+    $c->dump_these();
+    if ($c->_session) {
+        $c->res->write('LOADED')
+    }
+    else {
+        $c->res->write('NOT');
+    }
+}
+
 1;
index f2b1bd1..cbc7cc5 100644 (file)
@@ -16,8 +16,6 @@ BEGIN {
     }
     or plan skip_all =>
         'Test::WWW::Mechanize::Catalyst >= 0.51 is required for this test';
-
-    plan tests => 36;
 }
 
 use lib "t/lib";
@@ -83,6 +81,12 @@ $_->get_ok( "http://localhost/page", "get main page" ) for $ua1, $ua2;
 $ua1->content_contains( "please login", "ua1 not logged in" );
 $ua2->content_contains( "please login", "ua2 not logged in" );
 
+my $ua3 = Test::WWW::Mechanize::Catalyst->new;
+$ua3->get_ok( "http://localhost/login", "log ua3 in" );
+$ua3->get_ok( "http://localhost/dump_these_loads_session");
+$ua3->content_contains('NOT');
+
 diag("Testing against Catalyst $Catalyst::VERSION");
 diag("Testing Catalyst::Plugin::Session $Catalyst::Plugin::Session::VERSION");
 
+done_testing;