Create branch register_actions.
[catagits/Catalyst-Runtime.git] / t / aggregate / live_component_controller_action_multipath.t
CommitLineData
50cc3183 1#!perl
2
3use strict;
4use warnings;
5
6use FindBin;
ae29b412 7use lib "$FindBin::Bin/../lib";
50cc3183 8
9my $content = q/foo
10bar
11baz
12/;
13
14our $iters;
15
6b25e555 16BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
50cc3183 17
18use Test::More tests => 16*$iters;
19use Catalyst::Test 'TestApp';
20
21if ( $ENV{CAT_BENCHMARK} ) {
22 require Benchmark;
23 Benchmark::timethis( $iters, \&run_tests );
24}
25else {
26 for ( 1 .. $iters ) {
ae29b412 27 run_tests($content);
50cc3183 28 }
29}
30
31sub run_tests {
ae29b412 32 my ($content) = @_;
33
50cc3183 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}