fix whitespace tests
[catagits/Catalyst-Plugin-Session-State-Stash.git] / t / 05-live.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use FindBin qw/$Bin/;
7 use lib "$Bin/lib";
8
9 use URI::Escape;
10 use Test::More;
11
12 BEGIN {
13     eval { require Test::WWW::Mechanize::Catalyst };
14     plan skip_all =>
15       "This test requires Test::WWW::Mechanize::Catalyst in order to run"
16       if $@;
17     plan skip_all => 'Test::WWW::Mechanize::Catalyst >= 0.40 required' if $Test::WWW::Mechanize::Catalyst::VERSION < 0.40;
18 }
19
20 use Test::WWW::Mechanize::Catalyst qw/TestApp/;
21
22 my $m = Test::WWW::Mechanize::Catalyst->new;
23
24 #Number of tests to run. A begin block every 10 will ensure the count is correct
25 my $tests;
26 plan tests => $tests;
27
28 $m->get_ok( "http://localhost/start_session", "get page" );
29 my $session = uri_escape($m->content);
30
31 $m->get_ok( "http://localhost/page/$session", "get page" );
32 $m->content_contains( "hit number 2", "session data restored" );
33
34 $m->get_ok( "http://localhost/stream/$session", "get stream" );
35 $m->content_contains( "hit number 3", "session data restored" );
36
37 BEGIN { $tests += 5; }
38
39 $m->get_ok( "http://localhost/stream/$session", "get page" );
40 $m->content_contains( "hit number 4", "session data restored" );
41 $m->get_ok( "http://localhost/deleteme/$session", "get page" );
42
43 TODO: {
44     local $TODO = "Changing sessions is broken and I've had no success fixing it. Patches welcome";
45     $m->content_is( 'PASS' , 'session id changed' );
46 }
47 BEGIN { $tests += 4; }