Added tests for expiry threshold
[catagits/Catalyst-Plugin-Session.git] / t / live_expiry_threshold.t
CommitLineData
0421e89a 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More;
7
8BEGIN {
9 eval { require Catalyst::Plugin::Session::State::Cookie; Catalyst::Plugin::Session::State::Cookie->VERSION(0.03) }
10 or plan skip_all =>
11 "Catalyst::Plugin::Session::State::Cookie 0.03 or higher is required for this test";
12
13 eval {
14 require Test::WWW::Mechanize::Catalyst;
15 Test::WWW::Mechanize::Catalyst->VERSION(0.51);
16 }
17 or plan skip_all =>
18 'Test::WWW::Mechanize::Catalyst >= 0.51 is required for this test';
19}
20
21use lib "t/lib";
22use Test::WWW::Mechanize::Catalyst "SessionTestApp";
23
24my $ua = Test::WWW::Mechanize::Catalyst->new;
25
26my $res = $ua->get( "http://localhost/get_expires" );
27ok($res->is_success, "get expires");
28
29my $expiry = $res->decoded_content;
30
31sleep(1);
32
33$res = $ua->get( "http://localhost/get_expires" );
34ok($res->is_success, "get expires");
35
36is($res->decoded_content, $expiry, "expiration not updated");
37
38sleep(10);
39
40$res = $ua->get( "http://localhost/get_expires" );
41ok($res->is_success, "get expires");
42
43isnt($res->decoded_content, $expiry, "expiration updated");
44
45done_testing;