flash_to_stash goodness
[catagits/Catalyst-Plugin-Session.git] / t / 03_flash.t
index edbf607..a56c43b 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 6;
+use Test::More tests => 7;
 use Test::MockObject::Extends;
 use Test::Exception;
 
@@ -15,6 +15,8 @@ my $c = Test::MockObject::Extends->new( $m );
 $c->set_always( get_session_data => { } );
 $c->set_true( "store_session_data" );
 $c->set_always( _sessionid => "deadbeef");
+$c->set_always( config => { } );
+$c->set_always( stash => { } );
 
 $c->_load_flash;
 
@@ -40,3 +42,13 @@ $c->finalize;
 $c->_load_flash;
 
 is_deeply( $c->flash, {}, "nothing in flash");
+
+$c->flash->{bar} = "gorch";
+
+$c->config->{session}{flash_to_stash} = 1;
+
+$c->finalize;
+$c->prepare_action;
+
+is_deeply( $c->stash, { bar => "gorch" }, "flash copied to stash" );
+