[Catalyst-commits] r9336 - in Catalyst-Runtime/5.80/trunk/t:
aggregate lib/TestApp/Controller
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Thu Feb 19 01:20:15 GMT 2009
Author: rafl
Date: 2009-02-19 01:20:15 +0000 (Thu, 19 Feb 2009)
New Revision: 9336
Added:
Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_moose.t
Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Moose.pm
Log:
Add test for moose controller instances being constructed properly.
Added: Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_moose.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_moose.t (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_moose.t 2009-02-19 01:20:15 UTC (rev 9336)
@@ -0,0 +1,18 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+use Test::More tests => 2;
+use Catalyst::Test 'TestApp';
+
+{
+ my $response = request('http://localhost/moose/get_attribute');
+ ok($response->is_success);
+ is($response->content, '42', 'attribute default values get set correctly');
+}
Added: Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Moose.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Moose.pm (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Moose.pm 2009-02-19 01:20:15 UTC (rev 9336)
@@ -0,0 +1,19 @@
+package TestApp::Controller::Moose;
+
+use Moose;
+
+use namespace::clean -except => 'meta';
+
+BEGIN { extends qw/Catalyst::Controller/; }
+
+has attribute => (
+ is => 'ro',
+ default => 42,
+);
+
+sub get_attribute : Local {
+ my ($self, $c) = @_;
+ $c->response->body($self->attribute);
+}
+
+1;
More information about the Catalyst-commits
mailing list