fix tests for clear_flash (mocking was bad) v0.13
Yuval Kogman [Thu, 12 Oct 2006 19:46:46 +0000 (19:46 +0000)]
Changes
lib/Catalyst/Plugin/Session.pm
t/03_flash.t

diff --git a/Changes b/Changes
index f9cfbf1..24539bb 100644 (file)
--- a/Changes
+++ b/Changes
@@ -3,7 +3,7 @@ Revision history for Perl extension Catalyst::Plugin::Session
 0.13
         - Rerelease with slightly changed test due to a behavior change in
           Test::MockObject
-        - add `clear_flash` (still waiting for tests, mr. Rob Kinyon!)
+        - add `clear_flash`
         - improve debug logging
 
 0.12
index 1171491..d8ce67e 100644 (file)
@@ -390,7 +390,10 @@ sub flash {
 
 sub clear_flash {
     my $c = shift;
+    
+    #$c->delete_session_data("flash:" . $c->sessionid); # should this be in here? or delayed till finalization?
     $c->_flash_key_hashes({});
+    $c->_flash_keep_keys({});
     $c->_flash({});
 }
 
index c37624e..ca9b886 100644 (file)
@@ -19,8 +19,8 @@ $c->mock(
         return $key =~ /expire/ ? time() + 1000 : $flash;
     },
 );
-$c->set_true("store_session_data");
-$c->set_true("delete_session_data");
+$c->mock("store_session_data" => sub { $flash = $_[2] });
+$c->mock("delete_session_data" => sub { $flash = {} });
 $c->set_always( _sessionid => "deadbeef" );
 $c->set_always( config     => { session => { expires => 1000 } } );
 $c->set_always( stash      => {} );