Added high performance version of the Sessions code as a branch
[catagits/Catalyst-Plugin-Session.git] / t / 05_semi_persistent_flash.t
CommitLineData
95c6f6e8 1#!/usr/bin/perl -w
2use strict;
3
4use Test::More;
5
6BEGIN {
7
8 eval { require Test::WWW::Mechanize::Catalyst }
9 or plan skip_all =>
10 'Test::WWW::Mechanize::Catalyst is required for this test';
11
12 plan tests => '10';
13
14}
15
16use lib "t/lib";
17use Test::WWW::Mechanize::Catalyst 'FlashTestApp';
18
19my $ua = Test::WWW::Mechanize::Catalyst->new;
20
21# flash absent for initial request
22$ua->get_ok("http://localhost/first");
23$ua->content_contains( "flash is not set", "not set" );
24
25# present for 1st req.
26$ua->get_ok("http://localhost/second");
27$ua->content_contains( "flash set first time", "set first" );
28
29# should be the same 2nd req.
30$ua->get_ok("http://localhost/third");
31$ua->content_contains( "flash set second time", "set second" );
32
33# and the third request, flash->{is_set} has the same value as 2nd.
34$ua->get_ok("http://localhost/fourth");
35$ua->content_contains( "flash set 3rd time, same val as prev.", "set third" );
36
37# and should be absent again for the 4th req.
38$ua->get_ok("http://localhost/fifth");
39$ua->content_contains( "flash is not", "flash has gone" );
40