X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=trunk%2Ft%2Faggregate%2Flive_component_controller_action_multipath.t;fp=trunk%2Ft%2Faggregate%2Flive_component_controller_action_multipath.t;h=e4bb2424faa87d3159007aaeae1f74ec52985a9e;hb=e28a6876ad3e11890226e5bab6df4b0725e0981e;hp=0000000000000000000000000000000000000000;hpb=21c94d83082b43028cafcfb18659090b13d832fa;p=catagits%2FCatalyst-Runtime.git diff --git a/trunk/t/aggregate/live_component_controller_action_multipath.t b/trunk/t/aggregate/live_component_controller_action_multipath.t new file mode 100644 index 0000000..e4bb242 --- /dev/null +++ b/trunk/t/aggregate/live_component_controller_action_multipath.t @@ -0,0 +1,73 @@ +#!perl + +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/../lib"; + +my $content = q/foo +bar +baz +/; + +our $iters; + +BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } + +use Test::More tests => 16*$iters; +use Catalyst::Test 'TestApp'; + +if ( $ENV{CAT_BENCHMARK} ) { + require Benchmark; + Benchmark::timethis( $iters, \&run_tests ); +} +else { + for ( 1 .. $iters ) { + run_tests($content); + } +} + +sub run_tests { + my ($content) = @_; + + # Local + { + ok( + my $response = + request('http://localhost/action/multipath/multipath'), + 'Request' + ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->content, $content, 'Content is a stream' ); + } + + # Global + { + ok( my $response = request('http://localhost/multipath'), 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->content, $content, 'Content is a stream' ); + } + + # Path('/multipath1') + { + ok( my $response = request('http://localhost/multipath1'), 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->content, $content, 'Content is a stream' ); + } + + # Path('multipath2') + { + ok( + my $response = + request('http://localhost/action/multipath/multipath2'), + 'Request' + ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->content, $content, 'Content is a stream' ); + } +}