Added multiple paths support
[catagits/Catalyst-Runtime.git] / t / 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 use Test::More tests => 16;
10 use Catalyst::Test 'TestApp';
11
12 my $content = q/foo
13 bar
14 baz
15 /;
16
17 # Local
18 {
19     ok( my $response = request('http://localhost/action/multipath/multipath'),
20         'Request' );
21     ok( $response->is_success, 'Response Successful 2xx' );
22     is( $response->content_type, 'text/plain', 'Response Content-Type' );
23     is( $response->content, $content, 'Content is a stream' );
24 }
25
26 # Global
27 {
28     ok( my $response = request('http://localhost/multipath'), 'Request' );
29     ok( $response->is_success, 'Response Successful 2xx' );
30     is( $response->content_type, 'text/plain', 'Response Content-Type' );
31     is( $response->content, $content, 'Content is a stream' );
32 }
33
34 # Path('/multipath1')
35 {
36     ok( my $response = request('http://localhost/multipath1'), 'Request' );
37     ok( $response->is_success, 'Response Successful 2xx' );
38     is( $response->content_type, 'text/plain', 'Response Content-Type' );
39     is( $response->content, $content, 'Content is a stream' );
40 }
41
42 # Path('multipath2')
43 {
44     ok( my $response = request('http://localhost/action/multipath/multipath2'),
45         'Request' );
46     ok( $response->is_success, 'Response Successful 2xx' );
47     is( $response->content_type, 'text/plain', 'Response Content-Type' );
48     is( $response->content, $content, 'Content is a stream' );
49 }