Commit | Line | Data |
fbcc39ad |
1 | #!perl\r |
2 | \r |
3 | use strict;\r |
4 | use warnings;\r |
5 | \r |
6 | use FindBin;\r |
7 | use lib "$FindBin::Bin/../../../lib";\r |
8 | \r |
9 | use Test::More tests => 18;\r |
10 | use Catalyst::Test 'TestApp';\r |
11 | \r |
12 | \r |
13 | {\r |
14 | my @expected = qw[\r |
15 | TestApp::Controller::Action::Detach->begin\r |
16 | TestApp::Controller::Action::Detach->one\r |
17 | TestApp::Controller::Action::Detach->two\r |
18 | TestApp::View::Dump::Request->process\r |
19 | ];\r |
20 | \r |
21 | my $expected = join( ", ", @expected );\r |
22 | \r |
23 | # Test detach to chain of actions.\r |
24 | ok( my $response = request('http://localhost/action/detach/one'), 'Request' );\r |
25 | ok( $response->is_success, 'Response Successful 2xx' );\r |
26 | is( $response->content_type, 'text/plain', 'Response Content-Type' );\r |
27 | is( $response->header('X-Catalyst-Action'), 'action/detach/one', 'Test Action' );\r |
28 | is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Detach', 'Test Class' );\r |
29 | is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' );\r |
30 | }\r |
31 | \r |
32 | {\r |
33 | my @expected = qw[\r |
34 | TestApp::Controller::Action::Detach->begin\r |
35 | TestApp::Controller::Action::Detach->path\r |
36 | TestApp::Controller::Action::Detach->two\r |
37 | TestApp::View::Dump::Request->process\r |
38 | ];\r |
39 | \r |
40 | my $expected = join( ", ", @expected );\r |
41 | \r |
42 | # Test detach to chain of actions.\r |
43 | ok( my $response = request('http://localhost/action/detach/path'), 'Request' );\r |
44 | ok( $response->is_success, 'Response Successful 2xx' );\r |
45 | is( $response->content_type, 'text/plain', 'Response Content-Type' );\r |
46 | is( $response->header('X-Catalyst-Action'), 'action/detach/path', 'Test Action' );\r |
47 | is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Detach', 'Test Class' );\r |
48 | is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' );\r |
49 | }\r |
50 | \r |
51 | {\r |
52 | ok( my $response = request('http://localhost/action/detach/with_args/old'), 'Request with args' );\r |
53 | ok( $response->is_success, 'Response Successful 2xx' );\r |
54 | is( $response->content, 'new');\r |
55 | }\r |
56 | \r |
57 | {\r |
58 | ok( my $response = request('http://localhost/action/detach/with_method_and_args/old'), 'Request with args and method' );\r |
59 | ok( $response->is_success, 'Response Successful 2xx' );\r |
60 | is( $response->content, 'new');\r |
61 | }\r |