drop Catalyst::Action::REST from test
[catagits/Catalyst-Runtime.git] / t / abort-chain-1.t
1 use strict;
2 use warnings;
3 use Test::More tests => 1;
4 use HTTP::Request::Common;
5
6 BEGIN {
7     package TestApp::Controller::Root;
8     $INC{'TestApp/Controller/Root.pm'} = __FILE__;
9     use Moose;
10     use MooseX::MethodAttributes;
11     extends 'Catalyst::Controller';
12
13     has counter => (is => 'rw', isa => 'Int', default => sub { 0 });
14     sub increment {
15         my $self = shift;
16         $self->counter($self->counter + 1);
17     }
18     sub root :Chained('/') :PathPart('') :CaptureArgs(0) {
19         my ($self, $c, $arg) = @_;
20         die "Died in root";
21     }
22     sub main :Chained('root') :PathPart('') :Args(0) {
23         my ($self, $c, $arg) = @_;
24         $self->increment;
25         die "Died in main";
26     }
27     sub hits :Path('hits') :Args(0) {
28         my ($self, $c, $arg) = @_;
29         $c->response->body($self->counter);
30     }
31     __PACKAGE__->config(namespace => '');
32 }
33 {
34     package TestApp;
35     $INC{'TestApp.pm'} = __FILE__;
36     use Catalyst;
37     __PACKAGE__->setup('-Log=fatal');
38 }
39
40 use Catalyst::Test 'TestApp';
41
42 {
43     my $res = request('/');
44 }
45 {
46     my $res = request('/hits');
47     is $res->content, 0, "main action not touched on crash with no explicit setting";
48 }