f5960ef2d9cc0194df54c1d39b0a662e16f3089a
[catagits/Catalyst-Runtime.git] / t / custom_live_component_controller_action_auto_doublebug.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 tests => 3*$iters;
14 use Catalyst::Test 'TestAppDoubleAutoBug';
15
16 if ( $ENV{CAT_BENCHMARK} ) {
17     require Benchmark;
18     Benchmark::timethis( $iters, \&run_tests );
19 }
20 else {
21     for ( 1 .. $iters ) {
22         run_tests();
23     }
24 }
25     
26 sub run_tests {
27     SKIP:
28     {
29         if ( $ENV{CATALYST_SERVER} ) {
30             skip 'Using remote server', 3;
31         }
32         
33         {
34             my @expected = qw[
35                 TestAppDoubleAutoBug->auto
36                 TestAppDoubleAutoBug->default
37                 TestAppDoubleAutoBug->end
38             ];
39     
40             my $expected = join( ", ", @expected );
41     
42             ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' );
43             is( $response->header('X-Catalyst-Executed'),
44                 $expected, 'Executed actions' );
45             is( $response->content, 'default, auto=1', 'Content OK' );
46         }
47     }
48 }