-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path05_semi_persistent_flash.t
43 lines (31 loc) · 1.04 KB
/
05_semi_persistent_flash.t
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;