Merged 5.49_01 (r1339) from refactored branch to trunk
[catagits/Catalyst-Runtime.git] / t / live / engine / response / errors.t
CommitLineData
dd4e6fd2 1#!perl
2
3use strict;
4use warnings;
5
6use FindBin;
7use lib "$FindBin::Bin/../../lib";
8
c20bd9d9 9use Test::More tests => 18;
dd4e6fd2 10use Catalyst::Test 'TestApp';
11
ece55428 12close STDERR; # i'm naughty :)
13
dd4e6fd2 14{
15 ok( my $response = request('http://localhost/engine/response/errors/one'), 'Request' );
16 ok( $response->is_error, 'Response Server Error 5xx' );
17 is( $response->code, 500, 'Response Code' );
18 is( $response->content_type, 'text/html', 'Response Content-Type' );
19 is( $response->header('X-Catalyst-Action'), 'engine/response/errors/one', 'Test Action' );
20 like( $response->header('X-Catalyst-Error'), qr/^Caught exception/, 'Catalyst Error' );
21}
22
23{
24 ok( my $response = request('http://localhost/engine/response/errors/two'), 'Request' );
25 ok( $response->is_error, 'Client Error 4xx' );
26 is( $response->code, 404, 'Response Code' );
27 is( $response->content_type, 'text/html', 'Response Content-Type' );
28 is( $response->header('X-Catalyst-Action'), 'engine/response/errors/two', 'Test Action' );
3b2ed580 29 like( $response->header('X-Catalyst-Error'), qr/^Couldn't forward to/, 'Catalyst Error' );
dd4e6fd2 30}
31
32{
33 ok( my $response = request('http://localhost/engine/response/errors/three'), 'Request' );
34 ok( $response->is_error, 'Response Server Error 5xx' );
35 is( $response->code, 500, 'Response Code' );
36 is( $response->content_type, 'text/html', 'Response Content-Type' );
37 is( $response->header('X-Catalyst-Action'), 'engine/response/errors/three', 'Test Action' );
38 like( $response->header('X-Catalyst-Error'), qr/^Caught exception "I'm going to die!"$/, 'Catalyst Error' );
39}