Create branch register_actions.
[catagits/Catalyst-Runtime.git] / t / aggregate / live_engine_response_errors.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 => 18;
10 use Catalyst::Test 'TestApp';
11
12 close STDERR;    # i'm naughty :)
13
14 {
15     ok( my $response = request('http://localhost/engine/response/errors/one'),
16         'Request' );
17     ok( $response->is_error, 'Response Server Error 5xx' );
18     is( $response->code,         500,         'Response Code' );
19     is( $response->content_type, 'text/html', 'Response Content-Type' );
20     is( $response->header('X-Catalyst-Action'),
21         'engine/response/errors/one', 'Test Action' );
22     like(
23         $response->header('X-Catalyst-Error'),
24         qr/^Caught exception/,
25         'Catalyst Error'
26     );
27 }
28
29 {
30     ok( my $response = request('http://localhost/engine/response/errors/two'),
31         'Request' );
32     ok( $response->is_error, 'Response Server Error 5xx' );
33     is( $response->code,         500,         'Response Code' );
34     is( $response->content_type, 'text/html', 'Response Content-Type' );
35     is( $response->header('X-Catalyst-Action'),
36         'engine/response/errors/two', 'Test Action' );
37     like(
38         $response->header('X-Catalyst-Error'),
39         qr/^Couldn't forward to/,
40         'Catalyst Error'
41     );
42 }
43
44 {
45     ok( my $response = request('http://localhost/engine/response/errors/three'),
46         'Request' );
47     ok( $response->is_error, 'Response Server Error 5xx' );
48     is( $response->code,         500,         'Response Code' );
49     is( $response->content_type, 'text/html', 'Response Content-Type' );
50     is(
51         $response->header('X-Catalyst-Action'),
52         'engine/response/errors/three',
53         'Test Action'
54     );
55     like(
56         $response->header('X-Catalyst-Error'),
57         qr/I'm going to die!/,
58         'Catalyst Error'
59     );
60 }