Skip to content
Browse files

session で flash を扱うときのサンプル

  • Loading branch information...
1 parent 41dd97b commit 1544454037292bd91d00f973204040263475f18f @fujiwara fujiwara committed Aug 26, 2011
Showing with 18 additions and 0 deletions.
  1. +18 −0 t/plugin_session.t
View
18 t/plugin_session.t
@@ -24,11 +24,21 @@ use Test::Base;
$c->session->set('test', 'dummy');
}
+ sub test_flash_set :Local {
+ my ($self, $c) = @_;
+ $c->session->set('test', 'dummy_flash');
+ }
+
sub test_get :Local {
my ($self, $c) = @_;
$c->res->body( $c->session->get('test') );
}
+ sub test_flash_get :Local {
+ my ($self, $c) = @_;
+ $c->res->body( $c->session->remove('test') || "" );
+ }
+
sub incr :Local {
my ($self, $c) = @_;
@@ -65,6 +75,14 @@ use Ark::Test 'TestApp',
}
{
+ my $res = request(GET => '/test_flash_set');
+ like( $res->header('Set-Cookie'), qr/testapp_session=/, 'session id ok');
+
+ is(get('/test_flash_get'), 'dummy_flash', 'flash get ok');
+ is(get('/test_flash_get'), '', 'flash cleaered ok');
+}
+
+{
is(get('/incr'), 1, 'increment first ok');
is(get('/incr'), 2, 'increment second ok');
reset_app;

0 comments on commit 1544454

Please sign in to comment.
Something went wrong with that request. Please try again.