my ($meta, $config) = @_;
foreach my $name (keys %{ $config->{methods}}) {
my $m = $meta->get_method($name);
- $m->meta->get_attribute('attributes')->set_value($m, ['Local']);
+ $meta->register_method_attributes($m->body, ['Local']);
}
};
use Moose::Util qw/does_role/;
-use Test::More tests => 5;
+use Test::More tests => 6;
use DynamicAppDemo;
ok ! $controller->action_for('method_from_controller_role'),
'not leaking actions';
+ok $controller->action_for('say_hello'),
+ 'Am finding generated actions';
+
use FindBin qw/$Bin/;
use lib "$Bin/lib";
-use Test::More tests => 6;
+use Test::More tests => 4;
BEGIN { use_ok 'Catalyst::Test', 'DynamicAppDemo' }
{
- my $res = request('/fakeexample/register_me');
- ok( $res->is_success, 'should succeed' );
- is( $res->header('X-Foo'), 'bar', 'is calling correct code' );
-}
-
-{
my $res = request('/one/say_hello/world');
ok( $res->is_success, 'should succeed' );
is( $res->header('X-From-Model'), 'One' );
+++ /dev/null
-package DynamicAppDemo::Controller::FakeExample;
-use Moose;
-use namespace::autoclean;
-
-BEGIN { extends 'Catalyst::Controller' }
-with 'CatalystX::ModelToControllerReflector::ControllerRole';
-
-# This is a fake controller.
-
-# It exists to show an example of using ::ControllerBase which is autogenerated,
-# which helps me seperate the building and testing of the controller action
-# registration functionality, seperate the the code generation :)
-
-sub register_me {
- my ($self, $c) = @_;
- $c->res->body('quux');
- $c->res->header('X-Foo', 'bar');
-}
-
-sub _do_not_register_me { }
-
-# In a non-trivial example, you would use MX::Method::Sigs :)
-
-__PACKAGE__->meta->make_immutable;
-