Fixed some typos
[catagits/Catalyst-Runtime.git] / t / live / component / controller / action / private.t
CommitLineData
dd4e6fd2 1#!perl
2
3use strict;
4use warnings;
5
6use FindBin;
9770ad56 7use lib "$FindBin::Bin/../../../lib";
dd4e6fd2 8
d8c66af5 9use Test::More tests => 240;
dd4e6fd2 10use Catalyst::Test 'TestApp';
11
d8c66af5 12for ( 1 .. 10 ) {
13 {
14 ok( my $response = request('http://localhost/action/private/one'),
15 'Request' );
16 ok( $response->is_success, 'Response Successful 2xx' );
17 is( $response->content_type, 'text/plain', 'Response Content-Type' );
18 is(
19 $response->header('X-Test-Class'),
20 'TestApp::Controller::Action::Private',
21 'Test Class'
22 );
23 is( $response->content, 'access denied', 'Access' );
24 }
dd4e6fd2 25
d8c66af5 26 {
27 ok( my $response = request('http://localhost/action/private/two'),
28 'Request' );
29 ok( $response->is_success, 'Response Successful 2xx' );
30 is( $response->content_type, 'text/plain', 'Response Content-Type' );
31 is(
32 $response->header('X-Test-Class'),
33 'TestApp::Controller::Action::Private',
34 'Test Class'
35 );
36 is( $response->content, 'access denied', 'Access' );
37 }
dd4e6fd2 38
d8c66af5 39 {
40 ok( my $response = request('http://localhost/three'), 'Request' );
41 ok( $response->is_error, 'Response Server Error 5xx' );
42 is( $response->content_type, 'text/html', 'Response Content-Type' );
43 like(
44 $response->header('X-Catalyst-Error'),
45 qr/^Unknown resource "three"/,
46 'Catalyst Error'
47 );
48 }
dd4e6fd2 49
d8c66af5 50 {
51 ok( my $response = request('http://localhost/action/private/four'),
52 'Request' );
53 ok( $response->is_success, 'Response Successful 2xx' );
54 is( $response->content_type, 'text/plain', 'Response Content-Type' );
55 is(
56 $response->header('X-Test-Class'),
57 'TestApp::Controller::Action::Private',
58 'Test Class'
59 );
60 is( $response->content, 'access denied', 'Access' );
61 }
dd4e6fd2 62
d8c66af5 63 {
64 ok( my $response = request('http://localhost/action/private/five'),
65 'Request' );
66 ok( $response->is_success, 'Response Successful 2xx' );
67 is( $response->content_type, 'text/plain', 'Response Content-Type' );
68 is(
69 $response->header('X-Test-Class'),
70 'TestApp::Controller::Action::Private',
71 'Test Class'
72 );
73 is( $response->content, 'access denied', 'Access' );
74 }
dd4e6fd2 75}