Added some stress testing
[catagits/Catalyst-Runtime.git] / t / live / component / controller / action / detach.t
index f33ee7a..7ea99b4 100644 (file)
@@ -6,56 +6,79 @@ use warnings;
 use FindBin;\r
 use lib "$FindBin::Bin/../../../lib";\r
 \r
-use Test::More tests => 18;\r
+use Test::More tests => 180;\r
 use Catalyst::Test 'TestApp';\r
 \r
+for ( 1 .. 10 ) {\r
+    {\r
+        my @expected = qw[\r
+          TestApp::Controller::Action::Detach->begin\r
+          TestApp::Controller::Action::Detach->one\r
+          TestApp::Controller::Action::Detach->two\r
+          TestApp::View::Dump::Request->process\r
+        ];\r
 \r
-{\r
-    my @expected = qw[\r
-        TestApp::Controller::Action::Detach->begin\r
-        TestApp::Controller::Action::Detach->one\r
-        TestApp::Controller::Action::Detach->two\r
-        TestApp::View::Dump::Request->process\r
-    ];\r
+        my $expected = join( ", ", @expected );\r
 \r
-    my $expected = join( ", ", @expected );\r
+        # Test detach to chain of actions.\r
+        ok( my $response = request('http://localhost/action/detach/one'),\r
+            'Request' );\r
+        ok( $response->is_success, 'Response Successful 2xx' );\r
+        is( $response->content_type, 'text/plain', 'Response Content-Type' );\r
+        is( $response->header('X-Catalyst-Action'),\r
+            'action/detach/one', 'Test Action' );\r
+        is(\r
+            $response->header('X-Test-Class'),\r
+            'TestApp::Controller::Action::Detach',\r
+            'Test Class'\r
+        );\r
+        is( $response->header('X-Catalyst-Executed'),\r
+            $expected, 'Executed actions' );\r
+    }\r
 \r
-    # Test detach to chain of actions.\r
-    ok( my $response = request('http://localhost/action/detach/one'), 'Request' );\r
-    ok( $response->is_success, 'Response Successful 2xx' );\r
-    is( $response->content_type, 'text/plain', 'Response Content-Type' );\r
-    is( $response->header('X-Catalyst-Action'), 'action/detach/one', 'Test Action' );\r
-    is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Detach', 'Test Class' );\r
-    is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' );\r
-}\r
+    {\r
+        my @expected = qw[\r
+          TestApp::Controller::Action::Detach->begin\r
+          TestApp::Controller::Action::Detach->path\r
+          TestApp::Controller::Action::Detach->two\r
+          TestApp::View::Dump::Request->process\r
+        ];\r
 \r
-{\r
-    my @expected = qw[\r
-        TestApp::Controller::Action::Detach->begin\r
-        TestApp::Controller::Action::Detach->path\r
-        TestApp::Controller::Action::Detach->two\r
-        TestApp::View::Dump::Request->process\r
-    ];\r
-\r
-    my $expected = join( ", ", @expected );\r
-\r
-    # Test detach to chain of actions.\r
-    ok( my $response = request('http://localhost/action/detach/path'), 'Request' );\r
-    ok( $response->is_success, 'Response Successful 2xx' );\r
-    is( $response->content_type, 'text/plain', 'Response Content-Type' );\r
-    is( $response->header('X-Catalyst-Action'), 'action/detach/path', 'Test Action' );\r
-    is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Detach', 'Test Class' );\r
-    is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' );\r
-}\r
+        my $expected = join( ", ", @expected );\r
 \r
-{\r
-    ok( my $response = request('http://localhost/action/detach/with_args/old'), 'Request with args' );\r
-    ok( $response->is_success, 'Response Successful 2xx' );\r
-    is( $response->content, 'new');\r
-}\r
+        # Test detach to chain of actions.\r
+        ok( my $response = request('http://localhost/action/detach/path'),\r
+            'Request' );\r
+        ok( $response->is_success, 'Response Successful 2xx' );\r
+        is( $response->content_type, 'text/plain', 'Response Content-Type' );\r
+        is( $response->header('X-Catalyst-Action'),\r
+            'action/detach/path', 'Test Action' );\r
+        is(\r
+            $response->header('X-Test-Class'),\r
+            'TestApp::Controller::Action::Detach',\r
+            'Test Class'\r
+        );\r
+        is( $response->header('X-Catalyst-Executed'),\r
+            $expected, 'Executed actions' );\r
+    }\r
+\r
+    {\r
+        ok(\r
+            my $response =\r
+              request('http://localhost/action/detach/with_args/old'),\r
+            'Request with args'\r
+        );\r
+        ok( $response->is_success, 'Response Successful 2xx' );\r
+        is( $response->content, 'new' );\r
+    }\r
 \r
-{\r
-    ok( my $response = request('http://localhost/action/detach/with_method_and_args/old'), 'Request with args and method' );\r
-    ok( $response->is_success, 'Response Successful 2xx' );\r
-    is( $response->content, 'new');\r
+    {\r
+        ok(\r
+            my $response = request(\r
+                'http://localhost/action/detach/with_method_and_args/old'),\r
+            'Request with args and method'\r
+        );\r
+        ok( $response->is_success, 'Response Successful 2xx' );\r
+        is( $response->content, 'new' );\r
+    }\r
 }\r