Fixed some typos
[catagits/Catalyst-Runtime.git] / t / live / component / controller / action / detach.t
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 => 180;\r
10 use Catalyst::Test 'TestApp';\r
11 \r
12 for ( 1 .. 10 ) {\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'),\r
25             'Request' );\r
26         ok( $response->is_success, 'Response Successful 2xx' );\r
27         is( $response->content_type, 'text/plain', 'Response Content-Type' );\r
28         is( $response->header('X-Catalyst-Action'),\r
29             'action/detach/one', 'Test Action' );\r
30         is(\r
31             $response->header('X-Test-Class'),\r
32             'TestApp::Controller::Action::Detach',\r
33             'Test Class'\r
34         );\r
35         is( $response->header('X-Catalyst-Executed'),\r
36             $expected, 'Executed actions' );\r
37     }\r
38 \r
39     {\r
40         my @expected = qw[\r
41           TestApp::Controller::Action::Detach->begin\r
42           TestApp::Controller::Action::Detach->path\r
43           TestApp::Controller::Action::Detach->two\r
44           TestApp::View::Dump::Request->process\r
45         ];\r
46 \r
47         my $expected = join( ", ", @expected );\r
48 \r
49         # Test detach to chain of actions.\r
50         ok( my $response = request('http://localhost/action/detach/path'),\r
51             'Request' );\r
52         ok( $response->is_success, 'Response Successful 2xx' );\r
53         is( $response->content_type, 'text/plain', 'Response Content-Type' );\r
54         is( $response->header('X-Catalyst-Action'),\r
55             'action/detach/path', 'Test Action' );\r
56         is(\r
57             $response->header('X-Test-Class'),\r
58             'TestApp::Controller::Action::Detach',\r
59             'Test Class'\r
60         );\r
61         is( $response->header('X-Catalyst-Executed'),\r
62             $expected, 'Executed actions' );\r
63     }\r
64 \r
65     {\r
66         ok(\r
67             my $response =\r
68               request('http://localhost/action/detach/with_args/old'),\r
69             'Request with args'\r
70         );\r
71         ok( $response->is_success, 'Response Successful 2xx' );\r
72         is( $response->content, 'new' );\r
73     }\r
74 \r
75     {\r
76         ok(\r
77             my $response = request(\r
78                 'http://localhost/action/detach/with_method_and_args/old'),\r
79             'Request with args and method'\r
80         );\r
81         ok( $response->is_success, 'Response Successful 2xx' );\r
82         is( $response->content, 'new' );\r
83     }\r
84 }\r