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