Commit | Line | Data |
dd4e6fd2 |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use FindBin; |
7 | use lib "$FindBin::Bin/../../lib"; |
8 | |
c20bd9d9 |
9 | use Test::More tests => 18; |
dd4e6fd2 |
10 | use Catalyst::Test 'TestApp'; |
11 | |
ece55428 |
12 | close 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 | } |