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