actually document the new request body_data method
[catagits/Catalyst-Runtime.git] / t / aggregate / live_component_controller_action_multipath.t
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use FindBin;
7 use lib "$FindBin::Bin/../lib";
8
9 my $content = q/foo
10 bar
11 baz
12 /;
13
14 our $iters;
15
16 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
17
18 use Test::More tests => 16*$iters;
19 use Catalyst::Test 'TestApp';
20
21 if ( $ENV{CAT_BENCHMARK} ) {
22     require Benchmark;
23     Benchmark::timethis( $iters, \&run_tests );
24 }
25 else {
26     for ( 1 .. $iters ) {
27         run_tests($content);
28     }
29 }
30
31 sub run_tests {
32     my ($content) = @_;
33
34     # Local
35     {
36         ok(
37             my $response =
38               request('http://localhost/action/multipath/multipath'),
39             'Request'
40         );
41         ok( $response->is_success, 'Response Successful 2xx' );
42         is( $response->content_type, 'text/plain', 'Response Content-Type' );
43         is( $response->content, $content, 'Content is a stream' );
44     }
45
46     # Global
47     {
48         ok( my $response = request('http://localhost/multipath'), 'Request' );
49         ok( $response->is_success, 'Response Successful 2xx' );
50         is( $response->content_type, 'text/plain', 'Response Content-Type' );
51         is( $response->content, $content, 'Content is a stream' );
52     }
53
54     # Path('/multipath1')
55     {
56         ok( my $response = request('http://localhost/multipath1'), 'Request' );
57         ok( $response->is_success, 'Response Successful 2xx' );
58         is( $response->content_type, 'text/plain', 'Response Content-Type' );
59         is( $response->content, $content, 'Content is a stream' );
60     }
61
62     # Path('multipath2')
63     {
64         ok(
65             my $response =
66               request('http://localhost/action/multipath/multipath2'),
67             'Request'
68         );
69         ok( $response->is_success, 'Response Successful 2xx' );
70         is( $response->content_type, 'text/plain', 'Response Content-Type' );
71         is( $response->content, $content, 'Content is a stream' );
72     }
73 }