made a failing test
Rafael Kitover [Thu, 18 Jun 2009 21:38:40 +0000 (21:38 +0000)]
t/aggregate/live_component_controller_action_index_or_default_names.t [new file with mode: 0644]
t/lib/TestAppIndexDefault.pm [new file with mode: 0644]
t/lib/TestAppIndexDefault/Controller/IndexChained.pm [new file with mode: 0644]

diff --git a/t/aggregate/live_component_controller_action_index_or_default_names.t b/t/aggregate/live_component_controller_action_index_or_default_names.t
new file mode 100644 (file)
index 0000000..e5889bb
--- /dev/null
@@ -0,0 +1,29 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 1*$iters;
+
+use Catalyst::Test 'TestAppIndexDefault';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+    require Benchmark;
+    Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+    for ( 1 .. $iters ) {
+        run_tests();
+    }
+}
+
+sub run_tests {
+    is(get('/indexchained'), 'index_chained', ':Chained overrides index');
+}
diff --git a/t/lib/TestAppIndexDefault.pm b/t/lib/TestAppIndexDefault.pm
new file mode 100644 (file)
index 0000000..9a129cb
--- /dev/null
@@ -0,0 +1,8 @@
+package TestAppIndexDefault;
+use strict;
+use warnings;
+use Catalyst;
+
+__PACKAGE__->setup;
+
+1;
diff --git a/t/lib/TestAppIndexDefault/Controller/IndexChained.pm b/t/lib/TestAppIndexDefault/Controller/IndexChained.pm
new file mode 100644 (file)
index 0000000..18a8034
--- /dev/null
@@ -0,0 +1,12 @@
+package TestAppIndexDefault::Controller::IndexChained;
+
+use base 'Catalyst::Controller';
+
+sub index : Chained('/') PathPart('indexchained') CaptureArgs(0) {}
+
+sub index_endpoint : Chained('index') PathPart('') Args(0) {
+    my ($self, $c) = @_;
+    $c->res->body('index_chained');
+}
+
+1;