Commit | Line | Data |
13c6b4cc |
1 | use strict; |
2 | use warnings; |
3 | use lib 't/lib'; |
4 | |
5 | use Test::More tests => 6; |
6 | |
7 | use Catalyst::Test 'TestApp'; |
8 | |
9 | eval q{ |
10 | package TestApp::Controller::Action::Chained; |
11 | sub should_fail : Chained('should_fail') Args(0) {} |
12 | }; |
13 | ok(!$@); |
14 | |
15 | eval { TestApp->setup_actions; }; |
16 | like($@, qr|Actions cannot chain to themselves registering /action/chained/should_fail|, |
17 | 'Local self referencing attributes makes action setup fail'); |
18 | |
19 | eval 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 | }; |
26 | ok(!$@); |
27 | |
28 | eval { TestApp->setup_actions }; |
29 | like($@, qr|Actions cannot chain to themselves registering /action/chained/should_also_fail|, |
30 | 'Full path self referencing attributes makes action setup fail'); |
31 | |
32 | eval q{ |
33 | package TestApp::Controller::Action::Chained; |
34 | no warnings 'redefine'; |
35 | sub should_also_fail {} |
36 | }; |
37 | ok(!$@); |
38 | |
39 | eval { TestApp->setup_actions }; |
40 | ok(!$@, 'And ok again') or warn $@; |
41 | |