add github issue tracker links to contributing documentation
[catagits/Catalyst-Runtime.git] / t / dead_recursive_chained_attributes.t
CommitLineData
13c6b4cc 1use strict;
2use warnings;
3use lib 't/lib';
4
5use Test::More tests => 6;
6
7use Catalyst::Test 'TestApp';
8
9eval q{
10 package TestApp::Controller::Action::Chained;
11 sub should_fail : Chained('should_fail') Args(0) {}
12};
13ok(!$@);
14
15eval { TestApp->setup_actions; };
16like($@, qr|Actions cannot chain to themselves registering /action/chained/should_fail|,
17 'Local self referencing attributes makes action setup fail');
18
19eval q{
20 package TestApp::Controller::Action::Chained;
21 no warnings 'redefine';
22 sub should_fail {}
23 use warnings 'redefine';
24 sub should_also_fail : Chained('/action/chained/should_also_fail') Args(0) {}
25};
26ok(!$@);
27
28eval { TestApp->setup_actions };
29like($@, qr|Actions cannot chain to themselves registering /action/chained/should_also_fail|,
30 'Full path self referencing attributes makes action setup fail');
31
32eval q{
33 package TestApp::Controller::Action::Chained;
34 no warnings 'redefine';
35 sub should_also_fail {}
36};
37ok(!$@);
38
39eval { TestApp->setup_actions };
40ok(!$@, 'And ok again') or warn $@;
41