Fix plugin links in POD
[catagits/Catalyst-View-Component-SubInclude.git] / t / 02-app-keepstash.t
1 use strict;
2 use warnings;
3 use FindBin qw/$Bin/;
4 use lib "$Bin/lib";
5
6 use Test::More;
7 use Catalyst::Test 'KeepStash';
8
9 my $content;
10
11 $content = get('/subrequest_keepstash_index');
12
13 # Because of the way SubRequest and Catalyst interact, the first level of the stash will get copied. On return to the root request,
14 # the first level of the stash will remain intact. Deep datastructures will be changed by subrequests, though
15 like($content, qr/-------ROOT------------\nShallow value: 5\nDeep Value: 9\n/, 'Got expected values in the stash');
16 like($content, qr/-------1st-------------\nShallow value: 6\nDeep Value: 10\nNew Value: \n/, 'Got expected values in the 1st call');
17 like($content, qr/-------2nd-------------\nShallow value: 6\nDeep Value: 11\nNew Value: \n/, 'Got expected values in the 2nd call');
18
19 $content = get('/visit_keepstash_index');
20 like($content, qr/-------ROOT------------\nShallow value: 5\nDeep Value: 9\n/, 'Got expected values in the stash');
21 like($content, qr/-------1st-------------\nShallow value: 6\nDeep Value: 10\nNew Value: \n/,    'Got expected values in the 1st call');
22 like($content, qr/-------2nd-------------\nShallow value: 7\nDeep Value: 11\nNew Value: new\n/, 'Got expected values in the 2nd call');
23
24 done_testing;