Added recursive -r flag to prove example
[catagits/Catalyst-Runtime.git] / t / live / component / controller / action / private.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 => 24;
10 use Catalyst::Test 'TestApp';
11
12
13 {
14     ok( my $response = request('http://localhost/action/private/one'), 'Request' );
15     ok( $response->is_success, 'Response Successful 2xx' );
16     is( $response->content_type, 'text/plain', 'Response Content-Type' );
17     is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Private', 'Test Class' );
18     is( $response->content, 'access denied', 'Access' );
19 }
20
21 {
22     ok( my $response = request('http://localhost/action/private/two'), 'Request' );
23     ok( $response->is_success, 'Response Successful 2xx' );
24     is( $response->content_type, 'text/plain', 'Response Content-Type' );
25     is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Private', 'Test Class' );
26     is( $response->content, 'access denied', 'Access' );
27 }
28
29 {
30     ok( my $response = request('http://localhost/three'), 'Request' );
31     ok( $response->is_error, 'Response Server Error 5xx' );
32     is( $response->content_type, 'text/html', 'Response Content-Type' );
33     like( $response->header('X-Catalyst-Error'), qr/^Unknown resource "three"/, 'Catalyst Error' );
34 }
35
36 {
37     ok( my $response = request('http://localhost/action/private/four'), 'Request' );
38     ok( $response->is_success, 'Response Successful 2xx' );
39     is( $response->content_type, 'text/plain', 'Response Content-Type' );
40     is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Private', 'Test Class' );
41     is( $response->content, 'access denied', 'Access' );
42 }
43
44 {
45     ok( my $response = request('http://localhost/action/private/five'), 'Request' );
46     ok( $response->is_success, 'Response Successful 2xx' );
47     is( $response->content_type, 'text/plain', 'Response Content-Type' );
48     is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Private', 'Test Class' );
49     is( $response->content, 'access denied', 'Access' );
50 }