add test for attribute overrides
Peter Karman [Mon, 27 Apr 2009 14:52:27 +0000 (14:52 +0000)]
t/aggregate/live_component_controller_atttributes.t [new file with mode: 0644]
t/lib/TestApp/Controller/Attributes.pm [new file with mode: 0644]

diff --git a/t/aggregate/live_component_controller_atttributes.t b/t/aggregate/live_component_controller_atttributes.t
new file mode 100644 (file)
index 0000000..e8832d9
--- /dev/null
@@ -0,0 +1,19 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 4;
+use Catalyst::Test 'TestApp';
+
+ok( my $response = request('http://localhost/attributes/view'),
+    'get /attributes/view' );
+ok( !$response->is_success, 'Response Unsuccessful' );
+
+ok( $response = request('http://localhost/attributes/foo'),
+    "get /attributes/foo" );
+
+ok( $response->is_success, "Response OK" );
diff --git a/t/lib/TestApp/Controller/Attributes.pm b/t/lib/TestApp/Controller/Attributes.pm
new file mode 100644 (file)
index 0000000..6f8020b
--- /dev/null
@@ -0,0 +1,30 @@
+use strict;
+use warnings;
+
+package My::AttributesBaseClass;
+use base qw( Catalyst::Controller );
+
+sub fetch : Chained('/') PathPrefix CaptureArgs(1) {
+
+}
+
+sub view : PathPart Chained('fetch') Args(0) {
+
+}
+
+sub foo {    # no attributes
+
+}
+
+package TestApp::Controller::Attributes;
+use base qw(My::AttributesBaseClass);
+
+sub view {    # override attributes to "hide" url
+
+}
+
+sub foo : Local {
+
+}
+
+1;