File: custom_live_component_controller_action_auto_doublebug.t

package info (click to toggle)
libcatalyst-perl 5.7014-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,276 kB
  • ctags: 874
  • sloc: perl: 11,270; makefile: 48
file content (48 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!perl

use strict;
use warnings;

use FindBin;
use lib "$FindBin::Bin/lib";

our $iters;

BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }

use Test::More tests => 3*$iters;
use Catalyst::Test 'TestAppDoubleAutoBug';

if ( $ENV{CAT_BENCHMARK} ) {
    require Benchmark;
    Benchmark::timethis( $iters, \&run_tests );
}
else {
    for ( 1 .. $iters ) {
        run_tests();
    }
}
    
sub run_tests {
    SKIP:
    {
        if ( $ENV{CATALYST_SERVER} ) {
            skip 'Using remote server', 3;
        }
        
        {
            my @expected = qw[
                TestAppDoubleAutoBug->auto
                TestAppDoubleAutoBug->default
                TestAppDoubleAutoBug->end
            ];
    
            my $expected = join( ", ", @expected );
    
            ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' );
            is( $response->header('X-Catalyst-Executed'),
                $expected, 'Executed actions' );
            is( $response->content, 'default, auto=1', 'Content OK' );
        }
    }
}