File: 05_semi_persistent_flash.t

package info (click to toggle)
libcatalyst-plugin-session-perl 0.44-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 284 kB
  • sloc: perl: 937; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 1,066 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use strict;
use warnings;

use Test::Needs {
  'Catalyst::Plugin::Session::State::Cookie' => '0.03',
};

use Test::More;

use lib "t/lib";

use MiniUA;

my $ua = MiniUA->new('FlashTestApp');

my $res;

# flash absent for initial request
$res = $ua->get( "http://localhost/first" );
ok +$res->is_success;
like +$res->content, qr{flash is not set}, "not set";

# present for 1st req.
$res = $ua->get( "http://localhost/second");
ok +$res->is_success;
like +$res->content, qr{flash set first time}, "set first";

# should be the same 2nd req.
$res = $ua->get( "http://localhost/third");
ok +$res->is_success;
like +$res->content, qr{flash set second time}, "set second";

# and the third request, flash->{is_set} has the same value as 2nd.
$res = $ua->get( "http://localhost/fourth");
ok +$res->is_success;
like +$res->content, qr{flash set 3rd time, same val as prev.}, "set third";

# and should be absent again for the 4th req.
$res = $ua->get( "http://localhost/fifth");
ok +$res->is_success;
like +$res->content, qr{flash is not}, "flash has gone";

done_testing;