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