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