Change Catalsyt _parse_attrs so that when sub attr handlers:
[catagits/Catalyst-Runtime.git] / t / aggregate / live_component_controller_action_index_or_default.t
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use FindBin;
7 use lib "$FindBin::Bin/../lib";
8
9 our $iters;
10
11 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
12
13 use Test::More;
14 use Catalyst::Test 'TestAppIndexDefault';
15
16 plan 'skip_all' if ( $ENV{CATALYST_SERVER} );
17
18 plan tests => 6*$iters;
19
20 if ( $ENV{CAT_BENCHMARK} ) {
21     require Benchmark;
22     Benchmark::timethis( $iters, \&run_tests );
23 }
24 else {
25     for ( 1 .. $iters ) {
26         run_tests();
27     }
28 }
29
30 sub run_tests {
31     is(get('/indexchained'), 'index_chained', ':Chained overrides index');
32     is(get('/indexprivate'), 'index_private', 'index : Private still works');
33
34 # test :Path overriding default
35     is(get('/one_arg'), 'path_one_arg', ':Path overrides default');
36     is(get('/one_arg/foo/bar'), 'default', 'default still works');
37
38 # now the same thing with a namespace, and a trailing / on the :Path
39     is(get('/default/one_arg'), 'default_path_one_arg',
40         ':Path overrides default');
41     is(get('/default/one_arg/foo/bar'), 'default_default',
42         'default still works');
43 }