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